






#import "NotAlertView.h"
#import "SchemesSong.h"
#import "JobDegreeManager.h"
#import "Masonry.h"

#define millMix(saw) __weak typeof(saw) weak##saw = saw;
#define numberHex(saw) __strong typeof(saw) saw = weak##saw;

@interface NotAlertView()

@property (nonatomic, strong) UIView *menuNapBigMoleView;
@property (nonatomic, copy) GlobalRepairWaitAzimuthLuminanceFill completion;
@property (nonatomic, strong) UIStackView *tableBusyEarView;

@end

@implementation NotAlertView

- (void)dealloc {
    
}

- (instancetype)initWithFrame:(CGRect)frame
                          title:(NSString *)title
                        message:(NSString *)message
                   starBlustery:(NSArray<NSString *> *)starBlustery
                     completion:(GlobalRepairWaitAzimuthLuminanceFill)completion {
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
        self.completion = completion;
        
        
        self.menuNapBigMoleView = [[UIView alloc] init];
        self.menuNapBigMoleView.backgroundColor = [SchemesSong domainCatColor];
        self.menuNapBigMoleView.layer.cornerRadius = SchemesSong.targetRemote.primeAdapter;
        self.menuNapBigMoleView.clipsToBounds = YES;
        self.menuNapBigMoleView.translatesAutoresizingMaskIntoConstraints = NO;
        [self addSubview:self.menuNapBigMoleView];
        
        
        [NSLayoutConstraint activateConstraints:@[
            [self.menuNapBigMoleView.centerXAnchor constraintEqualToAnchor:self.centerXAnchor],
            [self.menuNapBigMoleView.centerYAnchor constraintEqualToAnchor:self.centerYAnchor],
            [self.menuNapBigMoleView.widthAnchor constraintEqualToConstant:270]
        ]];
        
        
        UIView *integralView = nil;
        CGFloat batterySilentActionsSquashSurface = 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.menuNapBigMoleView addSubview:titleLabel];
            
            [NSLayoutConstraint activateConstraints:@[
                [titleLabel.topAnchor constraintEqualToAnchor:self.menuNapBigMoleView.topAnchor constant:batterySilentActionsSquashSurface],
                [titleLabel.leadingAnchor constraintEqualToAnchor:self.menuNapBigMoleView.leadingAnchor constant:16],
                [titleLabel.trailingAnchor constraintEqualToAnchor:self.menuNapBigMoleView.trailingAnchor constant:-16]
            ]];
            
            integralView = titleLabel;
        }
        
        
        if (message.length > 0) {
            UILabel *binUnitLabel = [[UILabel alloc] init];
            binUnitLabel.text = message;
            binUnitLabel.textColor = UIColor.whiteColor;
            binUnitLabel.font = [UIFont systemFontOfSize:15];
            binUnitLabel.textAlignment = NSTextAlignmentCenter;
            binUnitLabel.numberOfLines = 0;
            binUnitLabel.translatesAutoresizingMaskIntoConstraints = NO;
            [self.menuNapBigMoleView addSubview:binUnitLabel];
            
            NSLayoutYAxisAnchor *topAnchor = integralView ? integralView.bottomAnchor : self.menuNapBigMoleView.topAnchor;
            CGFloat boxTheFlat = integralView ? 10 : batterySilentActionsSquashSurface;
            [NSLayoutConstraint activateConstraints:@[
                [binUnitLabel.topAnchor constraintEqualToAnchor:topAnchor constant:boxTheFlat],
                [binUnitLabel.leadingAnchor constraintEqualToAnchor:self.menuNapBigMoleView.leadingAnchor constant:16],
                [binUnitLabel.trailingAnchor constraintEqualToAnchor:self.menuNapBigMoleView.trailingAnchor constant:-16]
            ]];
            integralView = binUnitLabel;
        }
        
        
        self.tableBusyEarView = [[UIStackView alloc] init];
        self.tableBusyEarView.axis = UILayoutConstraintAxisVertical;
        self.tableBusyEarView.spacing = 1;  
        self.tableBusyEarView.distribution = UIStackViewDistributionFillEqually;
        self.tableBusyEarView.translatesAutoresizingMaskIntoConstraints = NO;
        [self.menuNapBigMoleView addSubview:self.tableBusyEarView];
        
        
        NSLayoutYAxisAnchor *clickShakeTemplateWidthSun = integralView ? integralView.bottomAnchor : self.menuNapBigMoleView.topAnchor;
        CGFloat reportsMapClientsInterOpt = integralView ? batterySilentActionsSquashSurface : batterySilentActionsSquashSurface;
        
        [NSLayoutConstraint activateConstraints:@[
            [self.tableBusyEarView.topAnchor constraintEqualToAnchor:clickShakeTemplateWidthSun constant:reportsMapClientsInterOpt],
            [self.tableBusyEarView.leadingAnchor constraintEqualToAnchor:self.menuNapBigMoleView.leadingAnchor],
            [self.tableBusyEarView.trailingAnchor constraintEqualToAnchor:self.menuNapBigMoleView.trailingAnchor],
            [self.tableBusyEarView.bottomAnchor constraintEqualToAnchor:self.menuNapBigMoleView.bottomAnchor]
        ]];
        
        
       
       if (starBlustery.count == 2) {
           
           self.tableBusyEarView = [[UIStackView alloc] init];
           self.tableBusyEarView.axis = UILayoutConstraintAxisHorizontal;
           self.tableBusyEarView.distribution = UIStackViewDistributionFillEqually;
           self.tableBusyEarView.spacing = 1;  
           self.tableBusyEarView.translatesAutoresizingMaskIntoConstraints = NO;
           [self.menuNapBigMoleView addSubview:self.tableBusyEarView];
           
           NSLayoutYAxisAnchor *clickShakeTemplateWidthSun = integralView ? integralView.bottomAnchor : self.menuNapBigMoleView.topAnchor;
           [NSLayoutConstraint activateConstraints:@[
               [self.tableBusyEarView.topAnchor constraintEqualToAnchor:clickShakeTemplateWidthSun constant:batterySilentActionsSquashSurface],
               [self.tableBusyEarView.leadingAnchor constraintEqualToAnchor:self.menuNapBigMoleView.leadingAnchor],
               [self.tableBusyEarView.trailingAnchor constraintEqualToAnchor:self.menuNapBigMoleView.trailingAnchor],
               [self.tableBusyEarView.bottomAnchor constraintEqualToAnchor:self.menuNapBigMoleView.bottomAnchor]
           ]];
           
           
           for (NSInteger i = 0; i < starBlustery.count; i++) {
               NSString *golfMain = starBlustery[i];
               UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
               [button setTitle:golfMain forState:UIControlStateNormal];
               button.titleLabel.font = [UIFont systemFontOfSize:17];
               [button setTitleColor:[SchemesSong domainCatColor] forState:UIControlStateNormal];
               [button setTitleColor:UIColor.lightGrayColor forState:UIControlStateHighlighted];
               button.backgroundColor = [UIColor whiteColor];
               button.tag = i;
               [button addTarget:self action:@selector(sayKeyReject:) forControlEvents:UIControlEventTouchUpInside];
               button.translatesAutoresizingMaskIntoConstraints = NO;
               [button.heightAnchor constraintEqualToConstant:40].active = YES;
               [self.tableBusyEarView addArrangedSubview:button];
           }
       } else {
           
           self.tableBusyEarView = [[UIStackView alloc] init];
           self.tableBusyEarView.axis = UILayoutConstraintAxisVertical;
           self.tableBusyEarView.spacing = 1;
           self.tableBusyEarView.distribution = UIStackViewDistributionFillEqually;
           self.tableBusyEarView.translatesAutoresizingMaskIntoConstraints = NO;
           [self.menuNapBigMoleView addSubview:self.tableBusyEarView];
           
           NSLayoutYAxisAnchor *clickShakeTemplateWidthSun = integralView ? integralView.bottomAnchor : self.menuNapBigMoleView.topAnchor;
           [NSLayoutConstraint activateConstraints:@[
               [self.tableBusyEarView.topAnchor constraintEqualToAnchor:clickShakeTemplateWidthSun constant:batterySilentActionsSquashSurface],
               [self.tableBusyEarView.leadingAnchor constraintEqualToAnchor:self.menuNapBigMoleView.leadingAnchor],
               [self.tableBusyEarView.trailingAnchor constraintEqualToAnchor:self.menuNapBigMoleView.trailingAnchor],
               [self.tableBusyEarView.bottomAnchor constraintEqualToAnchor:self.menuNapBigMoleView.bottomAnchor]
           ]];
           
           for (NSInteger i = 0; i < starBlustery.count; i++) {
               NSString *golfMain = starBlustery[i];
               UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
               [button setTitle:golfMain forState:UIControlStateNormal];
               button.titleLabel.font = [UIFont systemFontOfSize:17];
               [button setTitleColor:[SchemesSong domainCatColor] forState:UIControlStateNormal];
               [button setTitleColor:UIColor.lightGrayColor forState:UIControlStateHighlighted];
               button.backgroundColor = [UIColor whiteColor];
               button.tag = i;
               [button addTarget:self action:@selector(sayKeyReject:) forControlEvents:UIControlEventTouchUpInside];
               button.translatesAutoresizingMaskIntoConstraints = NO;
               [button.heightAnchor constraintEqualToConstant:40].active = YES;
               [self.tableBusyEarView addArrangedSubview:button];
           }
       }
    }
    return self;
}

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

+ (void)linearAlpineDryMetadataClickHighest:(NSString *)title
                        message:(NSString *)message
                   starBlustery:(NSArray<NSString *> *)starBlustery
                     completion:(GlobalRepairWaitAzimuthLuminanceFill)completion {
    
    NotAlertView *cover = [[NotAlertView alloc] initWithFrame:[UIScreen mainScreen].bounds
                                                 title:title
                                               message:message
                                          starBlustery:starBlustery
                                            completion:completion];
    
    
    [JobDegreeManager.shared badmintonOtherBasicSummarySomaliStreamView:cover];
    
    
    cover.alpha = 0.0;
    [UIView animateWithDuration:0.25 animations:^{
        cover.alpha = 1.0;
    }];
}

+ (void)linearAlpineDryMetadataClickHighest:(NSString *)title message:(NSString *)message completion:(GlobalRepairWaitAzimuthLuminanceFill)completion {
    [self linearAlpineDryMetadataClickHighest:title message:message starBlustery:@[SchemesSong.albumHexAgeFix.offLine] completion:completion];
}

@end
