//
//  MPPositive_ArtistShowListCollectionViewCell.swift
//  MusicPlayer
//
//  Created by Mr.Zhou on 2024/5/16.
//

import UIKit

class MPPositive_ArtistShowListCollectionViewCell: UICollectionViewCell {
    //预览图
    private lazy var coverImageView:UIImageView = {
        let imageView:UIImageView = .init()
        imageView.contentMode = .scaleAspectFill
        imageView.layer.masksToBounds = true
        imageView.layer.cornerRadius = 16*width
        return imageView
    }()
    //标题Label
    private lazy var titleLabel:UILabel = createLabel("Title", font: .systemFont(ofSize: 14*width, weight: .regular), textColor: .white, textAlignment: .left)
    //副标题
    private lazy var subtitleLabel:UILabel = createLabel("Title", font: .systemFont(ofSize: 12*width, weight: .regular), textColor: .init(hex: "#FFFFFF", alpha: 0.6), textAlignment: .left)
    var itemView:MPPositive_BrowseItemViewModel!{
        didSet{
            itemView.setUrltoImage(coverImageView)
            titleLabel.text = itemView.title
            subtitleLabel.text = itemView.subtitle
        }
    }
    override init(frame: CGRect) {
        super.init(frame: frame)
        backgroundColor = .clear
        configure()
    }
    
    required init?(coder: NSCoder) {
        super.init(coder: coder)
    }
    private func configure() {
        addSubview(coverImageView)
        coverImageView.snp.makeConstraints { make in
            make.left.top.right.equalToSuperview()
            make.height.equalTo(167*width)
        }
        addSubview(titleLabel)
        titleLabel.snp.makeConstraints { make in
            make.left.right.equalToSuperview()
            make.top.equalTo(coverImageView.snp.bottom).offset(16*width)
        }
        addSubview(subtitleLabel)
        subtitleLabel.snp.makeConstraints { make in
            make.left.right.bottom.equalToSuperview()
        }
    }
}
