






#import "TenAlertView.h"
#import "RowAirFloor.h"
#import "HangOrderManager.h"
#import "Masonry.h"

#define notDays(wet) __weak typeof(wet) weak##wet = wet;
#define schemeCup(wet) __strong typeof(wet) wet = weak##wet;

@interface TenAlertView()

@property (nonatomic, strong) UIView *earAllDepthRawView;
@property (nonatomic, copy) ScrollingGrayUndoLuminanceBackwardInverse completion;
@property (nonatomic, strong) UIStackView *routeChatterView;

@end

@implementation TenAlertView

- (void)dealloc {
    
}

- (instancetype)initWithFrame:(CGRect)frame
                          title:(NSString *)title
                        message:(NSString *)message
                   zipMoveAlong:(NSArray<NSString *> *)zipMoveAlong
                     completion:(ScrollingGrayUndoLuminanceBackwardInverse)completion {
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
        self.completion = completion;
        
        
        self.earAllDepthRawView = [[UIView alloc] init];
        self.earAllDepthRawView.backgroundColor = [RowAirFloor genderTooColor];
        self.earAllDepthRawView.layer.cornerRadius = RowAirFloor.loveHitOrder.timeCreation;
        self.earAllDepthRawView.clipsToBounds = YES;
        self.earAllDepthRawView.translatesAutoresizingMaskIntoConstraints = NO;
        [self addSubview:self.earAllDepthRawView];
        
        
        [NSLayoutConstraint activateConstraints:@[
            [self.earAllDepthRawView.centerXAnchor constraintEqualToAnchor:self.centerXAnchor],
            [self.earAllDepthRawView.centerYAnchor constraintEqualToAnchor:self.centerYAnchor],
            [self.earAllDepthRawView.widthAnchor constraintEqualToConstant:270]
        ]];
        
        
        UIView *blinkLawView = nil;
        CGFloat expensivePointersMenstrualFlexibleStylistic = 20;
        
        
        if (title.length > 0) {
            UILabel *titleLabel = [[UILabel alloc] init];
            titleLabel.text = title;
            titleLabel.textColor = UIColor.whiteColor;
            titleLabel.font = [UIFont boldSystemFontOfSize:18];
            titleLabel.textAlignment = NSTextAlignmentCenter;
            titleLabel.numberOfLines = 0;
            titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
            [self.earAllDepthRawView addSubview:titleLabel];
            
            [NSLayoutConstraint activateConstraints:@[
                [titleLabel.topAnchor constraintEqualToAnchor:self.earAllDepthRawView.topAnchor constant:expensivePointersMenstrualFlexibleStylistic],
                [titleLabel.leadingAnchor constraintEqualToAnchor:self.earAllDepthRawView.leadingAnchor constant:16],
                [titleLabel.trailingAnchor constraintEqualToAnchor:self.earAllDepthRawView.trailingAnchor constant:-16]
            ]];
            
            blinkLawView = titleLabel;
        }
        
        
        if (message.length > 0) {
            UILabel *rateSawLabel = [[UILabel alloc] init];
            rateSawLabel.text = message;
            rateSawLabel.textColor = UIColor.whiteColor;
            rateSawLabel.font = [UIFont systemFontOfSize:15];
            rateSawLabel.textAlignment = NSTextAlignmentCenter;
            rateSawLabel.numberOfLines = 0;
            rateSawLabel.translatesAutoresizingMaskIntoConstraints = NO;
            [self.earAllDepthRawView addSubview:rateSawLabel];
            
            NSLayoutYAxisAnchor *topAnchor = blinkLawView ? blinkLawView.bottomAnchor : self.earAllDepthRawView.topAnchor;
            CGFloat popoverCar = blinkLawView ? 10 : expensivePointersMenstrualFlexibleStylistic;
            [NSLayoutConstraint activateConstraints:@[
                [rateSawLabel.topAnchor constraintEqualToAnchor:topAnchor constant:popoverCar],
                [rateSawLabel.leadingAnchor constraintEqualToAnchor:self.earAllDepthRawView.leadingAnchor constant:16],
                [rateSawLabel.trailingAnchor constraintEqualToAnchor:self.earAllDepthRawView.trailingAnchor constant:-16]
            ]];
            blinkLawView = rateSawLabel;
        }
        
        
        self.routeChatterView = [[UIStackView alloc] init];
        self.routeChatterView.axis = UILayoutConstraintAxisVertical;
        self.routeChatterView.spacing = 1;  
        self.routeChatterView.distribution = UIStackViewDistributionFillEqually;
        self.routeChatterView.translatesAutoresizingMaskIntoConstraints = NO;
        [self.earAllDepthRawView addSubview:self.routeChatterView];
        
        
        NSLayoutYAxisAnchor *embeddingHostingOwnershipAdaptorVariance = blinkLawView ? blinkLawView.bottomAnchor : self.earAllDepthRawView.topAnchor;
        CGFloat scatteredPresentProcessLibraryBuilder = blinkLawView ? expensivePointersMenstrualFlexibleStylistic : expensivePointersMenstrualFlexibleStylistic;
        
        [NSLayoutConstraint activateConstraints:@[
            [self.routeChatterView.topAnchor constraintEqualToAnchor:embeddingHostingOwnershipAdaptorVariance constant:scatteredPresentProcessLibraryBuilder],
            [self.routeChatterView.leadingAnchor constraintEqualToAnchor:self.earAllDepthRawView.leadingAnchor],
            [self.routeChatterView.trailingAnchor constraintEqualToAnchor:self.earAllDepthRawView.trailingAnchor],
            [self.routeChatterView.bottomAnchor constraintEqualToAnchor:self.earAllDepthRawView.bottomAnchor]
        ]];
        
        
       
       if (zipMoveAlong.count == 2) {
           
           self.routeChatterView = [[UIStackView alloc] init];
           self.routeChatterView.axis = UILayoutConstraintAxisHorizontal;
           self.routeChatterView.distribution = UIStackViewDistributionFillEqually;
           self.routeChatterView.spacing = 1;  
           self.routeChatterView.translatesAutoresizingMaskIntoConstraints = NO;
           [self.earAllDepthRawView addSubview:self.routeChatterView];
           
           NSLayoutYAxisAnchor *embeddingHostingOwnershipAdaptorVariance = blinkLawView ? blinkLawView.bottomAnchor : self.earAllDepthRawView.topAnchor;
           [NSLayoutConstraint activateConstraints:@[
               [self.routeChatterView.topAnchor constraintEqualToAnchor:embeddingHostingOwnershipAdaptorVariance constant:expensivePointersMenstrualFlexibleStylistic],
               [self.routeChatterView.leadingAnchor constraintEqualToAnchor:self.earAllDepthRawView.leadingAnchor],
               [self.routeChatterView.trailingAnchor constraintEqualToAnchor:self.earAllDepthRawView.trailingAnchor],
               [self.routeChatterView.bottomAnchor constraintEqualToAnchor:self.earAllDepthRawView.bottomAnchor]
           ]];
           
           
           for (NSInteger i = 0; i < zipMoveAlong.count; i++) {
               NSString *eastView = zipMoveAlong[i];
               UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
               [button setTitle:eastView forState:UIControlStateNormal];
               button.titleLabel.font = [UIFont systemFontOfSize:17];
               [button setTitleColor:[RowAirFloor genderTooColor] forState:UIControlStateNormal];
               [button setTitleColor:UIColor.lightGrayColor forState:UIControlStateHighlighted];
               button.backgroundColor = [UIColor whiteColor];
               button.tag = i;
               [button addTarget:self action:@selector(modelLogFour:) forControlEvents:UIControlEventTouchUpInside];
               button.translatesAutoresizingMaskIntoConstraints = NO;
               [button.heightAnchor constraintEqualToConstant:40].active = YES;
               [self.routeChatterView addArrangedSubview:button];
           }
       } else {
           
           self.routeChatterView = [[UIStackView alloc] init];
           self.routeChatterView.axis = UILayoutConstraintAxisVertical;
           self.routeChatterView.spacing = 1;
           self.routeChatterView.distribution = UIStackViewDistributionFillEqually;
           self.routeChatterView.translatesAutoresizingMaskIntoConstraints = NO;
           [self.earAllDepthRawView addSubview:self.routeChatterView];
           
           NSLayoutYAxisAnchor *embeddingHostingOwnershipAdaptorVariance = blinkLawView ? blinkLawView.bottomAnchor : self.earAllDepthRawView.topAnchor;
           [NSLayoutConstraint activateConstraints:@[
               [self.routeChatterView.topAnchor constraintEqualToAnchor:embeddingHostingOwnershipAdaptorVariance constant:expensivePointersMenstrualFlexibleStylistic],
               [self.routeChatterView.leadingAnchor constraintEqualToAnchor:self.earAllDepthRawView.leadingAnchor],
               [self.routeChatterView.trailingAnchor constraintEqualToAnchor:self.earAllDepthRawView.trailingAnchor],
               [self.routeChatterView.bottomAnchor constraintEqualToAnchor:self.earAllDepthRawView.bottomAnchor]
           ]];
           
           for (NSInteger i = 0; i < zipMoveAlong.count; i++) {
               NSString *eastView = zipMoveAlong[i];
               UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
               [button setTitle:eastView forState:UIControlStateNormal];
               button.titleLabel.font = [UIFont systemFontOfSize:17];
               [button setTitleColor:[RowAirFloor genderTooColor] forState:UIControlStateNormal];
               [button setTitleColor:UIColor.lightGrayColor forState:UIControlStateHighlighted];
               button.backgroundColor = [UIColor whiteColor];
               button.tag = i;
               [button addTarget:self action:@selector(modelLogFour:) forControlEvents:UIControlEventTouchUpInside];
               button.translatesAutoresizingMaskIntoConstraints = NO;
               [button.heightAnchor constraintEqualToConstant:40].active = YES;
               [self.routeChatterView addArrangedSubview:button];
           }
       }
    }
    return self;
}

- (void)modelLogFour:(UIButton *)sender {
    
    [UIView animateWithDuration:0.25 animations:^{
        self.alpha = 0;
    } completion:^(BOOL finished) {
        [HangOrderManager.shared waxMustGreenWindow];
        
        if (self.completion) {
            self.completion(sender.tag);
        }
    }];
}

+ (void)temporalChangingOwnYouArabicResolving:(NSString *)title
                        message:(NSString *)message
                   zipMoveAlong:(NSArray<NSString *> *)zipMoveAlong
                     completion:(ScrollingGrayUndoLuminanceBackwardInverse)completion {
    
    TenAlertView *dance = [[TenAlertView alloc] initWithFrame:[UIScreen mainScreen].bounds
                                                 title:title
                                               message:message
                                          zipMoveAlong:zipMoveAlong
                                            completion:completion];
    
    
    [HangOrderManager.shared handlerNotSourceExpertShowersDayView:dance];
    
    
    dance.alpha = 0.0;
    [UIView animateWithDuration:0.25 animations:^{
        dance.alpha = 1.0;
    }];
}

+ (void)temporalChangingOwnYouArabicResolving:(NSString *)title message:(NSString *)message completion:(ScrollingGrayUndoLuminanceBackwardInverse)completion {
    [self temporalChangingOwnYouArabicResolving:title message:message zipMoveAlong:@[RowAirFloor.iconYellowCube.soloTip] completion:completion];
}

@end
