//
//  TSGeneralBtnView.swift
//  AIEmoji
//
//  Created by 100Years on 2025/3/11.
//

class TSGeneralBtnView: TSBaseView {

    var viewH:CGFloat = 64
    
    var clickBlock:()->Void

    init(clickBlock: @escaping () -> Void) {
        self.clickBlock = clickBlock
        super.init(frame: .zero)
    }
    
    @MainActor required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    //###################################### Button ######################################
    lazy var creatBtn: UIButton = {
        let submitBtn = kCreateNormalSubmitBtn(title: "Generate".localized) { [weak self]  in
            guard let self = self else { return }
            clickBlock()
        }
        submitBtn.cornerRadius = 24.0
        submitBtn.isEnabled = false
        return submitBtn
    }()
    


    override func creatUI() {
        
        contentView.addSubview(creatBtn)
        creatBtn.snp.makeConstraints { make in
            make.center.equalToSuperview()
            make.leading.equalTo(16)
            make.trailing.equalTo(-16)
            make.height.equalTo(48)
        }

    }

    func setBtnEnabled(isEnabled:Bool) {
        creatBtn.isEnabled = isEnabled
    }
}
