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

#import "XVMyCertificateView.h"
#import "XVVerticalButton.h"

@interface XVMyCertificateView()

@property (nonatomic, strong) XVVerticalButton *button;

@property (nonatomic, strong) UILabel *label;


@end

@implementation XVMyCertificateView

- (instancetype)init {
    if (self = [super init]) {
        [self setupUI];
    }
    return self;
}

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self setupUI];
    }
    return self;
}

- (void)setupUI {
    
    self.userInteractionEnabled = YES;
    
    [self addSubview:self.button];
    [self.button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self);
        make.size.mas_equalTo(CGSizeMake(62, 80));
        make.top.mas_equalTo(self);
    }];
    
    [self addSubview:self.label];
    [self.label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self);
        make.top.mas_equalTo(self.button.mas_bottom).mas_offset(2);
        make.left.right.mas_equalTo(self);
    }];
    
    
}
- (void)setNormalImageName:(NSString *)imageName selectedImgName:(NSString *)selectedImgName title:(nonnull NSString *)title{
    [_button setImage:IMG(imageName) forState:(UIControlStateNormal)];
    [_button setImage:IMG(selectedImgName) forState:(UIControlStateSelected)];
    _label.text = title;
}

- (XVVerticalButton *)button {
    if (_button == nil) {
        _button = [[XVVerticalButton alloc]init];
        _button.imageIsRound = NO;
        _button.imageViewMaxSize = CGSizeMake(62, 62);
        _button.imageTextSpace = 3;
        [_button setImage:IMG(@"群组 3") forState:(UIControlStateNormal)];
        [_button setTitle:@"未认证" forState:UIControlStateNormal];
        [_button setTitleColor:kHexRGB(0xF78606) forState:UIControlStateNormal];
        [_button setTitleColor:kHexRGB(0x00BE70) forState:UIControlStateSelected];
        _button.titleLabel.font = [UIFont systemFontOfSize:10];
        _button.userInteractionEnabled = NO;
    }
    return _button;
}

- (UILabel *)label {
    if (_label == nil) {
        _label = [[UILabel alloc]initWithText:@"实名认证" textColor:F_101010_COLOR textAlignment:(NSTextAlignmentCenter) fontSize:12];
    }
    return _label;
}

@end
