//
//  TSMSGAIDefaultHeaderView.swift
//  AIEmoji
//
//  Created by 100Years on 2025/2/21.
//

class TSMSGAIDefaultHeaderView: TSChatMsgBaseView {
    
//    var text:String
//    init(text:String) {
//        self.text = text
//        super.init(frame: .zero)
//    }
    
//    @MainActor required init?(coder: NSCoder) {
//        fatalError("init(coder:) has not been implemented")
//    }

    override func creatUI() {
        viewH = 52.0
        let view = creatAIDefaultHeaderView(text: "Greetings! Curious about\nwhat I can do?".localized)
        addSubview(view)
        view.snp.makeConstraints { make in
            make.edges.equalToSuperview()
        }
    }
    
    func creatAIDefaultHeaderView(text:String) -> UIView {
        let view = UIView()
        view.clipsToBounds = true
        
        let imageView = UIImageView.createImageView(imageName: "aichat_avatar")
        view.addSubview(imageView)
        imageView.snp.makeConstraints { make in
            make.leading.equalTo(16)
            make.top.equalTo(0)
            make.width.height.equalTo(80)
        }

        let textLabel = UILabel.createLabel(
            text: text,
            font: .font(size: 16,weight: .medium),
            textColor: .white,
            numberOfLines: 0
        )
        view.addSubview(textLabel)
        textLabel.snp.makeConstraints { make in
            make.leading.equalTo(imageView.snp.trailing).offset(8)
            make.trailing.lessThanOrEqualTo(-40)
            make.top.equalTo(0)
            make.bottom.equalTo(-8)
        }
        return view
    }
        
}
