package com.autotech.we1l.items

import com.autotech.we1l.my_classes.BaseItem
import com.autotech.we1l.tools.*
import org.json.JSONObject

class HotDeal(id: Int, val imageUrl: String, val content: String, val product: Product) : BaseItem(id) {

    constructor(hotDealJSON: JSONObject) : this(hotDealJSON.getInt(ATTR_ID), hotDealJSON.getString(ATTR_IMAGE_URL),
            hotDealJSON.getString(ATTR_CONTENT),
            Product(hotDealJSON.getJSONObject(ATTR_PRODUCT), hotDealJSON.getJSONObject(ATTR_PRODUCT).getInt(ATTR_CATEGORY_ID)))
}