//
//  TSAIRintoneHistorySectionHeaderView.swift
//  AIRingtone
//
//  Created by 100Years on 2025/3/18.
//

class TSAIRintoneHistorySectionHeaderView: UICollectionReusableView {
    static let reuseIdentifier = "TSAIRintoneHistorySectionHeaderView"
    
    let titleView: TSTGPTitleView = {
        let titleView = TSTGPTitleView()
        return titleView
    }()
    
    lazy var rightBtn: TSUIExpandedTouchButton = {
        let rightBtn = TSUIExpandedTouchButton()
        rightBtn.setUpButton(title: "See All".localized,font: .font(size: 14),titleColor: .themeColor)
        return rightBtn
    }()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        addSubview(titleView)
        titleView.snp.makeConstraints { make in
            make.edges.equalToSuperview()
        }
        
        addSubview(rightBtn)
        rightBtn.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.trailing.equalTo(-16)
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}


class TSAIRintoneHistorySectionFooterView: UICollectionReusableView {
    static let reuseIdentifier = "TSAIRintoneHistorySectionFooterView"
    var clickView:(()->Void)?
    
    lazy var moreView: UIView = {
        let moreView = UIView()
        moreView.backgroundColor = .white.withAlphaComponent(0.1)
        moreView.cornerRadius = 10.0
        let textLabel = UILabel.createLabel(text: "more".localized,font: .font(size: 12),textColor: .white.withAlphaComponent(0.6))
        moreView.addSubview(textLabel)
        
        let imageView = UIImageView.createImageView(imageName: "gary_right_arrow")
        moreView.addSubview(imageView)
        
        textLabel.snp.makeConstraints { make in
            make.leading.equalTo(8)
            make.centerY.equalToSuperview()
        }
        
        imageView.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.leading.equalTo(textLabel.snp.trailing).offset(2)
            make.width.height.equalTo(12)
            make.trailing.equalTo(-4)
        }
        moreView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(clickMoreView)))
        return moreView
    }()
    
    
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        addSubview(moreView)
        moreView.snp.makeConstraints { make in
            make.center.equalToSuperview()
            make.height.equalTo(20)
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    @objc func clickMoreView() {
        clickView?()
    }
}
