






#import "FaxAlertView.h"
#import "AdverbTamil.h"
#import "StrictBigManager.h"
#import "Masonry.h"

#define zeroTab(its) __weak typeof(its) weak##its = its;
#define dryButton(its) __strong typeof(its) its = weak##its;

@interface FaxAlertView()

@property (nonatomic, strong) UIView *vitaminContainView;
@property (nonatomic, copy) UnloadDecipherChildScanCreatorFailure completion;
@property (nonatomic, strong) UIStackView *sheLiftHumanView;

@end

@implementation FaxAlertView

- (void)dealloc {
    
}

- (instancetype)initWithFrame:(CGRect)frame
                          title:(NSString *)title
                        message:(NSString *)message
                   sonPatchJust:(NSArray<NSString *> *)sonPatchJust
                     completion:(UnloadDecipherChildScanCreatorFailure)completion {
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
        self.completion = completion;
        
        
        self.vitaminContainView = [[UIView alloc] init];
        self.vitaminContainView.backgroundColor = [AdverbTamil sexCopperColor];
        self.vitaminContainView.layer.cornerRadius = 8.0;
        self.vitaminContainView.clipsToBounds = YES;
        self.vitaminContainView.translatesAutoresizingMaskIntoConstraints = NO;
        [self addSubview:self.vitaminContainView];
        
        
        [NSLayoutConstraint activateConstraints:@[
            [self.vitaminContainView.centerXAnchor constraintEqualToAnchor:self.centerXAnchor],
            [self.vitaminContainView.centerYAnchor constraintEqualToAnchor:self.centerYAnchor],
            [self.vitaminContainView.widthAnchor constraintEqualToConstant:270]
        ]];
        
        
        UIView *wrongEndView = nil;
        CGFloat stateLogFormattedSerialMount = 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.vitaminContainView addSubview:titleLabel];
            
            [NSLayoutConstraint activateConstraints:@[
                [titleLabel.topAnchor constraintEqualToAnchor:self.vitaminContainView.topAnchor constant:stateLogFormattedSerialMount],
                [titleLabel.leadingAnchor constraintEqualToAnchor:self.vitaminContainView.leadingAnchor constant:16],
                [titleLabel.trailingAnchor constraintEqualToAnchor:self.vitaminContainView.trailingAnchor constant:-16]
            ]];
            
            wrongEndView = titleLabel;
        }
        
        
        if (message.length > 0) {
            UILabel *falloffLabel = [[UILabel alloc] init];
            falloffLabel.text = message;
            falloffLabel.textColor = UIColor.whiteColor;
            falloffLabel.font = [UIFont systemFontOfSize:15];
            falloffLabel.textAlignment = NSTextAlignmentCenter;
            falloffLabel.numberOfLines = 0;
            falloffLabel.translatesAutoresizingMaskIntoConstraints = NO;
            [self.vitaminContainView addSubview:falloffLabel];
            
            NSLayoutYAxisAnchor *topAnchor = wrongEndView ? wrongEndView.bottomAnchor : self.vitaminContainView.topAnchor;
            CGFloat sodiumLead = wrongEndView ? 10 : stateLogFormattedSerialMount;
            [NSLayoutConstraint activateConstraints:@[
                [falloffLabel.topAnchor constraintEqualToAnchor:topAnchor constant:sodiumLead],
                [falloffLabel.leadingAnchor constraintEqualToAnchor:self.vitaminContainView.leadingAnchor constant:16],
                [falloffLabel.trailingAnchor constraintEqualToAnchor:self.vitaminContainView.trailingAnchor constant:-16]
            ]];
            wrongEndView = falloffLabel;
        }
        
        
        self.sheLiftHumanView = [[UIStackView alloc] init];
        self.sheLiftHumanView.axis = UILayoutConstraintAxisVertical;
        self.sheLiftHumanView.spacing = 1;  
        self.sheLiftHumanView.distribution = UIStackViewDistributionFillEqually;
        self.sheLiftHumanView.translatesAutoresizingMaskIntoConstraints = NO;
        [self.vitaminContainView addSubview:self.sheLiftHumanView];
        
        
        NSLayoutYAxisAnchor *ignoresScheduledContrastCatalystZone = wrongEndView ? wrongEndView.bottomAnchor : self.vitaminContainView.topAnchor;
        CGFloat contactSayFurlongsStackBox = wrongEndView ? stateLogFormattedSerialMount : stateLogFormattedSerialMount;
        
        [NSLayoutConstraint activateConstraints:@[
            [self.sheLiftHumanView.topAnchor constraintEqualToAnchor:ignoresScheduledContrastCatalystZone constant:contactSayFurlongsStackBox],
            [self.sheLiftHumanView.leadingAnchor constraintEqualToAnchor:self.vitaminContainView.leadingAnchor],
            [self.sheLiftHumanView.trailingAnchor constraintEqualToAnchor:self.vitaminContainView.trailingAnchor],
            [self.sheLiftHumanView.bottomAnchor constraintEqualToAnchor:self.vitaminContainView.bottomAnchor]
        ]];
        
        
       
       if (sonPatchJust.count == 2) {
           
           self.sheLiftHumanView = [[UIStackView alloc] init];
           self.sheLiftHumanView.axis = UILayoutConstraintAxisHorizontal;
           self.sheLiftHumanView.distribution = UIStackViewDistributionFillEqually;
           self.sheLiftHumanView.spacing = 1;  
           self.sheLiftHumanView.translatesAutoresizingMaskIntoConstraints = NO;
           [self.vitaminContainView addSubview:self.sheLiftHumanView];
           
           NSLayoutYAxisAnchor *ignoresScheduledContrastCatalystZone = wrongEndView ? wrongEndView.bottomAnchor : self.vitaminContainView.topAnchor;
           [NSLayoutConstraint activateConstraints:@[
               [self.sheLiftHumanView.topAnchor constraintEqualToAnchor:ignoresScheduledContrastCatalystZone constant:stateLogFormattedSerialMount],
               [self.sheLiftHumanView.leadingAnchor constraintEqualToAnchor:self.vitaminContainView.leadingAnchor],
               [self.sheLiftHumanView.trailingAnchor constraintEqualToAnchor:self.vitaminContainView.trailingAnchor],
               [self.sheLiftHumanView.bottomAnchor constraintEqualToAnchor:self.vitaminContainView.bottomAnchor]
           ]];
           
           
           for (NSInteger i = 0; i < sonPatchJust.count; i++) {
               NSString *fatScore = sonPatchJust[i];
               UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
               [button setTitle:fatScore forState:UIControlStateNormal];
               button.titleLabel.font = [UIFont systemFontOfSize:17];
               [button setTitleColor:[AdverbTamil sexCopperColor] forState:UIControlStateNormal];
               [button setTitleColor:UIColor.lightGrayColor forState:UIControlStateHighlighted];
               button.backgroundColor = [UIColor whiteColor];
               button.tag = i;
               [button addTarget:self action:@selector(useInterFeet:) forControlEvents:UIControlEventTouchUpInside];
               button.translatesAutoresizingMaskIntoConstraints = NO;
               [button.heightAnchor constraintEqualToConstant:40].active = YES;
               [self.sheLiftHumanView addArrangedSubview:button];
           }
       } else {
           
           self.sheLiftHumanView = [[UIStackView alloc] init];
           self.sheLiftHumanView.axis = UILayoutConstraintAxisVertical;
           self.sheLiftHumanView.spacing = 1;
           self.sheLiftHumanView.distribution = UIStackViewDistributionFillEqually;
           self.sheLiftHumanView.translatesAutoresizingMaskIntoConstraints = NO;
           [self.vitaminContainView addSubview:self.sheLiftHumanView];
           
           NSLayoutYAxisAnchor *ignoresScheduledContrastCatalystZone = wrongEndView ? wrongEndView.bottomAnchor : self.vitaminContainView.topAnchor;
           [NSLayoutConstraint activateConstraints:@[
               [self.sheLiftHumanView.topAnchor constraintEqualToAnchor:ignoresScheduledContrastCatalystZone constant:stateLogFormattedSerialMount],
               [self.sheLiftHumanView.leadingAnchor constraintEqualToAnchor:self.vitaminContainView.leadingAnchor],
               [self.sheLiftHumanView.trailingAnchor constraintEqualToAnchor:self.vitaminContainView.trailingAnchor],
               [self.sheLiftHumanView.bottomAnchor constraintEqualToAnchor:self.vitaminContainView.bottomAnchor]
           ]];
           
           for (NSInteger i = 0; i < sonPatchJust.count; i++) {
               NSString *fatScore = sonPatchJust[i];
               UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
               [button setTitle:fatScore forState:UIControlStateNormal];
               button.titleLabel.font = [UIFont systemFontOfSize:17];
               [button setTitleColor:[AdverbTamil sexCopperColor] forState:UIControlStateNormal];
               [button setTitleColor:UIColor.lightGrayColor forState:UIControlStateHighlighted];
               button.backgroundColor = [UIColor whiteColor];
               button.tag = i;
               [button addTarget:self action:@selector(useInterFeet:) forControlEvents:UIControlEventTouchUpInside];
               button.translatesAutoresizingMaskIntoConstraints = NO;
               [button.heightAnchor constraintEqualToConstant:40].active = YES;
               [self.sheLiftHumanView addArrangedSubview:button];
           }
       }
    }
    return self;
}

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

+ (void)heartbeatToneAdaptiveDutchPlacementTeaspoons:(NSString *)title
                        message:(NSString *)message
                   sonPatchJust:(NSArray<NSString *> *)sonPatchJust
                     completion:(UnloadDecipherChildScanCreatorFailure)completion {
    
    FaxAlertView *space = [[FaxAlertView alloc] initWithFrame:[UIScreen mainScreen].bounds
                                                 title:title
                                               message:message
                                          sonPatchJust:sonPatchJust
                                            completion:completion];
    
    
    [StrictBigManager.shared notCheckoutMenAccountsOverallStrokedView:space];
    
    
    space.alpha = 0.0;
    [UIView animateWithDuration:0.25 animations:^{
        space.alpha = 1.0;
    }];
}

+ (void)heartbeatToneAdaptiveDutchPlacementTeaspoons:(NSString *)title message:(NSString *)message completion:(UnloadDecipherChildScanCreatorFailure)completion {
    [self heartbeatToneAdaptiveDutchPlacementTeaspoons:title message:message sonPatchJust:@[AdverbTamil.takeCellTagBus.instant] completion:completion];
}

@end
