//
//  XVHealthCardTypeViewController.m
//  fastservice
//
//  Created by xuning on 4/29/25.
//  Copyright © 2025 FastService. All rights reserved.
//

#import "XVHealthCardTypeViewController.h"
#import "XVHealthCardTypeView.h"
#import "XVUploadHealthCardViewController.h"

@interface XVHealthCardTypeViewController ()


@property (nonatomic, strong) UIScrollView *scrollView;

@property (nonatomic, strong) UILabel *titleLabel;


@property (nonatomic, strong) XVHealthCardTypeView *type1View;

@property (nonatomic, strong) XVHealthCardTypeView *type2View;

@property (nonatomic, strong) XVHealthCardTypeView *type3View;

@property (nonatomic, strong) XVHealthCardTypeView *type4View;



@end

@implementation XVHealthCardTypeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.title = @"上传健康证";
    [self setupUI];
    
}

- (void)setupUI {
    
    [self.view addSubview:self.scrollView];
    
    [self.scrollView addSubview:self.titleLabel];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.scrollView).mas_offset(14);
        make.left.mas_equalTo(self.view).mas_offset(13);
    }];
    
    [self.scrollView addSubview:self.type1View];
    [self.type1View mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.view).mas_offset(9);
        make.right.mas_equalTo(self.view).mas_offset(-9);
        make.top.mas_equalTo(self.titleLabel.mas_bottom).mas_offset(10);
        make.height.mas_equalTo(102);
    }];
    
    kViewBorderRadius(self.type1View, 20, 0, [UIColor whiteColor]);
    
    [self.scrollView addSubview:self.type2View];
    [self.type2View mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.height.right.mas_equalTo(self.type1View);
        make.top.mas_equalTo(self.type1View.mas_bottom).mas_offset(10);
    }];
    kViewBorderRadius(self.type2View, 20, 0, [UIColor whiteColor]);
    
    [self.scrollView addSubview:self.type3View];
    [self.type3View mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.height.right.mas_equalTo(self.type1View);
        make.top.mas_equalTo(self.type2View.mas_bottom).mas_offset(10);
    }];
    kViewBorderRadius(self.type3View, 20, 0, [UIColor whiteColor]);

    [self.scrollView addSubview:self.type4View];
    [self.type4View mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.height.right.mas_equalTo(self.type1View);
        make.top.mas_equalTo(self.type3View.mas_bottom).mas_offset(10);
        make.bottom.mas_equalTo(self.scrollView).mas_offset(-40);
    }];

    kViewBorderRadius(self.type4View, 20, 0, [UIColor whiteColor]);

}

- (UIScrollView *)scrollView {
    if (_scrollView == nil) {
        _scrollView = [[UIScrollView alloc]initWithFrame:self.view.bounds];
        _scrollView.backgroundColor = DEFAULT_BACKGROUND_COLOR;
        _scrollView.alwaysBounceVertical = YES;
    }
    return _scrollView;
}

- (UILabel *)titleLabel {
    if (_titleLabel == nil) {
        _titleLabel = [[UILabel alloc]initWithText:@"请选择健康证类型" textColor:F_101010_COLOR textAlignment:(NSTextAlignmentLeft) fontSize:18];
    }
    return _titleLabel;
}

- (XVHealthCardTypeView *)type1View {
    if (_type1View == nil) {
        _type1View = [[XVHealthCardTypeView alloc]init];
        _type1View.backgroundColor = [UIColor whiteColor];
        [_type1View title:@"卡制" subTitle:@"印有个人信息及日期的卡片"];
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithActionBlock:^(id  _Nonnull sender) {
            XVUploadHealthCardViewController *vc = [[XVUploadHealthCardViewController alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
        }];
        [_type1View addGestureRecognizer:tap];
    }
    return _type1View;
}

- (XVHealthCardTypeView *)type2View {
    if (_type2View == nil) {
        _type2View = [[XVHealthCardTypeView alloc]init];
        _type2View.backgroundColor = [UIColor whiteColor];
        [_type2View title:@"本制" subTitle:@"含有手写和机打信息、印章的本子"];
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithActionBlock:^(id  _Nonnull sender) {
            XVUploadHealthCardViewController *vc = [[XVUploadHealthCardViewController alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
        }];
        [_type2View addGestureRecognizer:tap];

    }
    return _type2View;
}

- (XVHealthCardTypeView *)type3View {
    if (_type3View == nil) {
        _type3View = [[XVHealthCardTypeView alloc]init];
        _type3View.backgroundColor = [UIColor whiteColor];
        [_type3View title:@"纸制" subTitle:@"含有手写和机打信息、印章的纸张"];
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithActionBlock:^(id  _Nonnull sender) {
            XVUploadHealthCardViewController *vc = [[XVUploadHealthCardViewController alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
        }];
        [_type3View addGestureRecognizer:tap];

    }
    return _type3View;
}

- (XVHealthCardTypeView *)type4View {
    if (_type4View == nil) {
        _type4View = [[XVHealthCardTypeView alloc]init];
        _type4View.backgroundColor = [UIColor whiteColor];
        [_type4View title:@"电子" subTitle:@"官方渠道下载的含有个人信息及日期的图片"];
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithActionBlock:^(id  _Nonnull sender) {
            XVUploadHealthCardViewController *vc = [[XVUploadHealthCardViewController alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
        }];
        [_type4View addGestureRecognizer:tap];

    }
    return _type4View;
}



@end
