//
//  PQStuckPointMusicTagsModel.swift
//  PQSpeed
//
//  Created by SanW on 2021/4/28.
//  Copyright © 2021 BytesFlow. All rights reserved.
//

import UIKit
import BFCommonKit

public class PQStuckPointMusicTagsModel: NSObject {
    public var parentTagId: Int64? // 父级 ID（如果是第一层，值为 0） ,
    public var rankScore: Int64 = 0 // 排序分数 ,
    public var tagColor: String? // 标签颜色（16进制格式，例如 #FF0000） ,
    public var tagEmoji: String? // 标签emoji表情 ,
    public var tagId: Int64? // 标签ID ,
    public var tagName: String? // 标签名
    public var isSelected: Bool = false // 是否被选中
    // 标签大小
    public var tagSize: CGSize = CGSize(width: cDefaultMargin * 6, height: cDefaultMargin * 3)

    public override init() {
        super.init()
    }

    public init(jsonDict: [String: Any]) {
        super.init()
        if jsonDict.keys.contains("parentTagId") {
            parentTagId = Int64("\(jsonDict["parentTagId"] ?? "")") ?? 0
        }
        if jsonDict.keys.contains("rankScore") {
            rankScore = Int64("\(jsonDict["rankScore"] ?? "")") ?? 0
        }
        if jsonDict.keys.contains("tagColor"), "\(jsonDict["tagColor"] ?? "")" != "<null>" {
            tagColor = "\(jsonDict["tagColor"] ?? "")"
        }
        if jsonDict.keys.contains("tagEmoji"), "\(jsonDict["tagEmoji"] ?? "")" != "<null>" {
            tagEmoji = "\(jsonDict["tagEmoji"] ?? "")"
        }
        if jsonDict.keys.contains("tagId") {
            tagId = Int64("\(jsonDict["tagId"] ?? "")") ?? 0
        }
        if jsonDict.keys.contains("tagName"), "\(jsonDict["tagName"] ?? "")" != "<null>" {
            tagName = "\(jsonDict["tagName"] ?? "")"
        }
    }
}
