//
//  MPPositive_CollectionListViewModel.swift
//  MusicPlayer
//
//  Created by Mr.Zhou on 2024/5/28.
//

import UIKit
import Kingfisher
///收藏歌单实体ViewModel
class MPPositive_CollectionListViewModel: NSObject {
    ///封面
    var coverURL:URL!
    ///标题
    var title:String?
    ///副标题
    var subtitle:String?
    ///收藏列表实体
    var collectionList:MPPositive_CollectionListModel
    
    init(_ list:MPPositive_CollectionListModel) {
        collectionList = list
        super.init()
        configure()
    }
    //配置数据
    private func configure() {
        if collectionList.coverImage != nil {
            coverURL = collectionList.coverImage
        }
        title = collectionList.title
        subtitle = collectionList.subtitle
    }
    //设置预览图
    func setImage(_ imageView:UIImageView) {
        if coverURL != nil {
            imageView.kf.setImage(with: coverURL, placeholder: placeholderImage)
        }
    }
}
