//
//  PlayListAddCell.swift
//  ColorfulWallpaper
//
//  Created by ni on 2024/9/19.
//

import Foundation
import TSVideoKit
import UIKit

class PlayListAddCell: UITableViewCell {
    lazy var iconView: UIImageView = .simpleImage(imageName: "ic_addplaylist")
    lazy var titleLabel: UILabel = .simpleLabel(text: "Create Playlist".localized(), font: .systemFont16, color: .white)

    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        backgroundColor = .clear
        selectionStyle = .none
        addChildren()
        makeConstraint()
    }

    func addChildren() {
        addSubview(iconView)
        addSubview(titleLabel)
    }

    func makeConstraint() {
        iconView.snp.makeConstraints { make in
            make.leading.equalToSuperview().offset(16)
            make.width.height.equalTo(56)
            make.top.equalToSuperview().offset(12)
            make.bottom.equalToSuperview().offset(-12)
        }

        titleLabel.snp.makeConstraints { make in
            make.leading.equalTo(iconView.snp.trailing).offset(12)
            make.trailing.equalToSuperview().offset(-16)
            make.centerY.equalToSuperview()
        }
    }

    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}

class PlayListFavouriteCell: PlayListCell {
    func updateCount(count: Int = 0) {
        moreButton.isHidden = true
        iconView.image = UIImage(named: "ic_playlist_like")
        titleLabel.text = "Like".localized()
        titleLabel.textColor = .white
        countLabel.text = "\(count)"
    }
}
