//
//  TSThemeSetItemView.swift
//  AIRingtone
//
//  Created by 100Years on 2025/3/3.
//

class TSThemeSetItemView: TSBaseView {
 
    let iconImageView = UIImageView()

    lazy var bgImageView: UIImageView = {
        let image = UIImage(named: "theme_set_bg")!.resizableImage(withCapInsets: UIEdgeInsets(top:60, left: 36, bottom: 60, right: 118), resizingMode: .stretch)
        let imageView = UIImageView()
        imageView.image = image
        imageView.contentMode = .scaleToFill
        return imageView
    }()
    let numImageView = UIImageView()

    lazy var titleLabel: UILabel = {
        let titleLabel = UILabel.createLabel(font: .font(name: .PoppinsBlackItalic,size: 18),textColor: .white)
        return titleLabel
    }()
    
    let diyView = UIView()
    
    let setBtn:UIButton = UIButton.createButton(title: "Set Now".localized,backgroundColor: .themeColor,font: .font(size: 16),titleColor: .white,corner: 16)
    
    let moreInfoBtn = kCreateMoreInfoBtn()
    
    override func creatUI() {

        setBtn.setTitleImageSpace(spacing: 4)
        contentView.snp.updateConstraints { make in
            make.top.equalTo(16)
        }
        
        contentView.addSubview(bgImageView)
        contentView.addSubview(numImageView)
        contentView.addSubview(titleLabel)
        contentView.addSubview(moreInfoBtn)
        contentView.addSubview(diyView)
        contentView.addSubview(setBtn)
        
        addSubview(iconImageView)
        
        bgImageView.snp.makeConstraints { make in
            make.leading.top.trailing.bottom.equalTo(0)
        }
    
        numImageView.snp.makeConstraints { make in
            make.leading.equalTo(12)
            make.top.equalTo(20)
            make.width.height.equalTo(24)
        }
        
        titleLabel.snp.makeConstraints { make in
            make.leading.equalTo(44)
            make.top.equalTo(20)
        }
        
        moreInfoBtn.snp.makeConstraints { make in
            make.leading.equalTo(titleLabel.snp.trailing).offset(8)
            make.width.height.equalTo(16)
            make.centerY.equalTo(titleLabel)
        }
        
        diyView.snp.makeConstraints { make in
            make.leading.trailing.equalTo(0)
            make.top.equalTo(60)
            make.bottom.equalTo(-60)
        }
        
        setBtn.snp.makeConstraints { make in
            make.height.equalTo(32)
            make.width.equalTo(161)
            make.centerX.equalToSuperview()
            make.bottom.equalTo(-16)
        }
        
        iconImageView.snp.makeConstraints { make in
            make.trailing.equalTo(-16)
            make.top.equalTo(0)
            make.width.height.equalTo(68)
        }
        
    }
}
