//
//  XVPasswordViewController.m
//  fastservice
//
//  Created by xuning on 2/4/24.
//  Copyright © 2024 FastService. All rights reserved.
//

#import "XVPasswordViewController.h"
#import "XVInputFieldView.h"

@interface XVPasswordViewController ()

@property (nonatomic, strong) UILabel *titleLabel;

// 手机号
@property (nonatomic, strong) XVInputFieldView *phoneView;
// 验证码
@property (nonatomic, strong) XVInputFieldView *smsCodeView;
// 图片验证码
@property (nonatomic, strong) XVInputFieldView *imgCodeView;
// 密码
@property (nonatomic, strong) XVInputFieldView *passwordView;

@property (nonatomic, strong) UILabel *tipLabel;


@property (nonatomic, strong) UIButton *sureButton;


@end

@implementation XVPasswordViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self setupUI];
}

- (void)setupUI {
    
    [self.view addSubview:self.titleLabel];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.mas_equalTo(self.view).mas_offset(30);
    }];
    
    
    [self.view addSubview:self.phoneView];
    [self.phoneView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.titleLabel.mas_bottom).mas_offset(29);
        make.left.mas_equalTo(self.view).mas_offset(30);
        make.right.mas_equalTo(self.view).mas_offset(-30);
        make.height.mas_equalTo(30);
    }];
    
    [self.view addSubview:self.smsCodeView];
    [self.smsCodeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.phoneView.mas_bottom).mas_offset(31);
        make.left.mas_equalTo(self.view).mas_offset(30);
        make.right.mas_equalTo(self.view).mas_offset(-30);
        make.height.mas_equalTo(30);
    }];
    
    [self.view addSubview:self.imgCodeView];
    [self.imgCodeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.smsCodeView.mas_bottom).mas_offset(31);
        make.left.mas_equalTo(self.view).mas_offset(30);
        make.right.mas_equalTo(self.view).mas_offset(-30);
        make.height.mas_equalTo(30);
    }];
    
    [self.view addSubview:self.passwordView];
    [self.passwordView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.imgCodeView.mas_bottom).mas_offset(31);
        make.left.mas_equalTo(self.view).mas_offset(30);
        make.right.mas_equalTo(self.view).mas_offset(-30);
        make.height.mas_equalTo(30);
    }];
    
    [self.view addSubview:self.tipLabel];
    [self.tipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.mas_equalTo(self.passwordView).mas_offset(8);
        
    }];
    
    [self.view addSubview:self.sureButton];
    [self.sureButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.view).mas_offset(66);
        make.right.mas_equalTo(self.view).mas_offset(-66);
        make.height.mas_equalTo(44);
        make.top.mas_equalTo(self.passwordView.mas_bottom).mas_offset(64);
    }];
    kViewBorderRadius(self.sureButton, 10, 0, [UIColor clearColor]);

    
}

- (UILabel *)titleLabel {
    if(_titleLabel == nil) {
        _titleLabel = [[UILabel alloc]initWithText:@"找回密码" textColor:F_3D3B4F_COLOR textAlignment:NSTextAlignmentLeft fontSize:24];
    }
    return _titleLabel;
}

//
- (XVInputFieldView *)phoneView {
    if(_phoneView == nil) {
        _phoneView = [[XVInputFieldView alloc]initWithType:InputTypeSmsCode placeholder:@"请输入手机号"];
    }
    return _phoneView;
}
- (XVInputFieldView *)smsCodeView {
    if(_smsCodeView == nil) {
        _smsCodeView = [[XVInputFieldView alloc]initWithType:InputTypeNumber placeholder:@"请输入验证码"];
    }
    return _smsCodeView;
}

- (XVInputFieldView *)imgCodeView {
    if(_imgCodeView == nil) {
        _imgCodeView = [[XVInputFieldView alloc]initWithType:InputTypeSmsCode placeholder:@"请输入图片验证码"];
    }
    return _imgCodeView;
}


- (XVInputFieldView *)passwordView {
    if(_passwordView == nil) {
        _passwordView = [[XVInputFieldView alloc]initWithType:InputTypePassword placeholder:@"请设置登录密码"];
    }
    return _passwordView;
}
- (UILabel *)tipLabel {
    if(_tipLabel == nil) {
        _tipLabel = [[UILabel alloc]initWithText:@"密码长度6-20位" textColor:BB_3_COLOR textAlignment:(NSTextAlignmentLeft) fontSize:10];
    }
    return _tipLabel;
}

- (UIButton *)sureButton {
    if(_sureButton == nil) {
        _sureButton = [[UIButton alloc]initWithTitle:@"确定" fontSize:16 titleColor:[UIColor whiteColor] bgColor:COLOR_THEMEGRENN];
        WS(weakSelf);
        [_sureButton addBlockForControlEvents:UIControlEventTouchUpInside block:^(id  _Nonnull sender) {
    
        }];
    }
    return _sureButton;
}

@end
