//
//  GMGeneMemoryGenderSelectView.m
//  Gengmei
//
//  Created by 朱璇 on 2019/12/5.
//  Copyright © 2019 更美互动信息科技有限公司. All rights reserved.
//
#import "GMGeneMemoryGenderSelectView.h"
@implementation GMGeneMemoryGenderSelectView
-(void)setup{
    [super setup];
    self.animationType = GMPopupAnimationTypeFade;
    self.container.backgroundColor = UIColor.clearColor;

    [self.container mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self);
    }];
    
    UILabel *titleLabel = [[UILabel alloc] init];
    titleLabel.text = @"开始扫脸前";
    titleLabel.textColor = UIColor.whiteColor;
    titleLabel.textAlignment = NSTextAlignmentCenter;
    titleLabel.font = [UIFont gmFont:14];
    [self addSubview:titleLabel];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(174.0 / 667 * MAINSCREEN_HEIGHT);
        make.centerX.mas_equalTo(0);
        make.height.mas_equalTo(14);
    }];
    
    UILabel *contentLabel = [[UILabel alloc] init];
    contentLabel.text = @"请先选择您的性别";
    contentLabel.textColor = UIColor.whiteColor;
    contentLabel.textAlignment = NSTextAlignmentCenter;
    contentLabel.font = [UIFont gmFont:14];
    [self addSubview:contentLabel];
    [contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(titleLabel.mas_bottom).offset(20);
        make.centerX.mas_equalTo(0);
        make.height.mas_equalTo(14);
    }];
    
    UIButton *femaleBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    femaleBtn.backgroundColor = [UIColor colorWithHex:0 alpha:.1];
    femaleBtn.layer.cornerRadius = 20;
    femaleBtn.layer.masksToBounds = YES;
    [femaleBtn setBackgroundImage:[UIImage imageNamed:@"gene_female"] forState:UIControlStateNormal];
    [femaleBtn addTarget:self action:@selector(femaleClicked) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:femaleBtn];
    femaleBtn.layer.borderColor = UIColor.whiteColor.CGColor;
    [femaleBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(contentLabel.mas_bottom).offset(20);
        make.centerX.mas_equalTo(0);
        make.height.mas_equalTo(40);
        make.width.mas_equalTo(118);
    }];
    
    UIButton *maleBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    maleBtn.backgroundColor = [UIColor colorWithHex:0 alpha:.1];
    maleBtn.layer.cornerRadius = 20;
    maleBtn.layer.masksToBounds = YES;
    [maleBtn setBackgroundImage:[UIImage imageNamed:@"gene_male"] forState:UIControlStateNormal];
    [maleBtn addTarget:self action:@selector(maleClicked) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:maleBtn];
    maleBtn.layer.borderColor = UIColor.whiteColor.CGColor;
    [maleBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(femaleBtn.mas_bottom).offset(14);
        make.centerX.mas_equalTo(0);
        make.height.mas_equalTo(40);
        make.width.mas_equalTo(118);
    }];
}

- (void)femaleClicked {
    [self hide];
    if ([self.selectDelegate respondsToSelector:@selector(didClickGender:)]) {
        [Phobos track:@"on_click_button" attributes:@{@"page_name": @"face_scan", @"button_name": @"female",@"tab_name": @"AI面孔"}];
        [self.selectDelegate didClickGender:0];
    }
}

- (void)maleClicked {
    [self hide];
    if ([self.selectDelegate respondsToSelector:@selector(didClickGender:)]) {
        [Phobos track:@"on_click_button" attributes:@{@"page_name": @"face_scan", @"button_name": @"male",@"tab_name": @"AI面孔"}];
        [self.selectDelegate didClickGender:1];
    }
}

- (void)hide {
    self.hidden = YES;
}

- (void)didTapView {
    
}

@end
