//
//  PlayButtonView.swift
//  ColorfulWallpaper
//
//  Created by nkl on 2024/9/13.
//

import Foundation
import UIKit

enum PlayState {
    case pause
    case playing
}

class PlayButtonView: UIControl {
    var playingState: PlayState = .pause {
        didSet {
            if playingState == .pause {
                iconView.image = UIImage(named: "ic_detail_playBtn")
            } else {
                iconView.image = UIImage(named: "ic_detail_pauseBtn")
            }
        }
    }

    lazy var iconView: UIImageView = .init(image: UIImage(named: "ic_detail_playBtn"))

    override init(frame: CGRect) {
        super.init(frame: frame)
        addChildren()
        makeConstraints()
    }

    func addChildren() {
        addSubview(iconView)
    }

    func makeConstraints() {
        iconView.contentMode = .scaleAspectFit
        iconView.snp.makeConstraints { make in
            make.edges.equalToSuperview()
        }
    }

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