//
//  QSLGoodModel.swift
//  QuickSearchLocation
//
//  Created by Destiny on 2024/12/11.
//

import MoyaMapper
import SwiftyJSON

struct QSLGoodModel: Modelable {
    
    var goodId: Int = 0
    
    var appleGoodsId: String = ""
    
    var sort: Int = 0
    
    var name: String = ""
    
    var level: Int = 0
    
    var content: String = ""
    
    var originalAmount: CGFloat = 0.0
    
    var amount: CGFloat = 0.0
    
    var subscriptionMillis: Int = 0
    
    var tag: String = ""
    
    var popular: Bool = false
    
    var newcomer: Bool = false
    
    var isSelect: Bool = false
    
    var subscribable : Int = 0
    
    ///感谢支持，您的套餐会员天数将额外增加 %day 天
    var text : String = ""
    
    ///额外信息填充内容
    var keys : QSLGoodKeysModel = QSLGoodKeysModel()
    
    
    mutating func mapping(_ json: JSON) {
        self.goodId = json["id"].intValue
        self.content = json["description"].stringValue
        
        var keysModel = QSLGoodKeysModel()
        keysModel.mapping(json["key"]) // 假设 JSON 中嵌套字段名为 "keys"
        self.keys = keysModel
    }
}
