//
//  YHResignSelectApplicantCollectCell.swift
//  galaxy
//
//  Created by edy on 2024/10/12.
//  Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//

import UIKit

class YHResignSelectApplicantCollectCell: UICollectionViewCell {

    static let cellReuseIdentifier = "YHResignSelectApplicantCollectCell"

    lazy var selectImgView: UIImageView = {
        let view = UIImageView(image: UIImage(named: ""))
        return view
    }()
    
    lazy var nameLabel: UILabel = {
        let label = UILabel()
        label.font = UIFont.PFSC_R(ofSize: 14)
        label.textColor = .mainTextColor
        return label
    }()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        createUI()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func createUI() {
        self.addSubview(selectImgView)
        self.addSubview(nameLabel)
        
        selectImgView.snp.makeConstraints { make in
            make.left.equalTo(0)
            make.width.height.equalTo(14)
            make.centerY.equalToSuperview()
        }
        
        nameLabel.snp.makeConstraints { make in
            make.left.equalTo(selectImgView.snp.right).offset(6)
            make.centerY.equalToSuperview()
            make.right.equalToSuperview()
        }
    }
    
    func updateApplicantInfo(_ applicant: YHResignAppointMember) {
        nameLabel.text = applicant.apply_name
        nameLabel.textColor = applicant.isSelected ? .brandMainColor : .mainTextColor
        let imgName = applicant.isSelected ? "login_privacy_agree" :  "login_privacy_disagree_glay"
        selectImgView.image = UIImage(named: imgName)
    }
}
