package com.unibuy.smartdevice.structure;

public class BuyStructure {
    private int field;
    private int slot;
    private ProductStructure product;
    private int count;
    private boolean isMarketingPlan;
    private boolean isFreeGift;

    /*
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("key", apiKey);
        jsonObject.put("machine", MachineName);
        jsonObject.put("tid", trackID + "");
        jsonObject.put(TPDNetworkConstants.ARG_SAMSUNG_PAY_PRIME_TYPE, type);
        String receive = DoPut(DomainName + "products/exp/B025", jsonObject.toString());
     */

    public BuyStructure(int field, int slot, ProductStructure product, int count) {
        this.field = field;
        this.slot = slot;
        this.product = product;
        this.count = count;
        this.isMarketingPlan = false;
        this.isFreeGift = false;
    }

    public int getField() {
        return field;
    }

    public void setField(int field) {
        this.field = field;
    }

    public int getSlot() {
        return this.slot;
    }

    public void setSlot(int slot) {
        this.slot = slot;
    }
    public ProductStructure getProduct() {
        return this.product;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public void setProduct(ProductStructure product) {
        this.product = product;
    }

    public int getFullPrice() {
        int count = getCount();
        int price = getProduct().getRealPrice();
        return count * price;
    }

    public boolean isMarketingPlan() {
        return isMarketingPlan;
    }

    public void setMarketingPlan(boolean marketingPlan) {
        isMarketingPlan = marketingPlan;
    }

    public boolean isFreeGift() {
        return isFreeGift;
    }

    public void setFreeGift(boolean freeGift) {
        isFreeGift = freeGift;
    }

    @Override
    public String toString() {
        return "BuyStructure{" +
                "field=" + field +
                ", slot=" + slot +
                ", product=" + (product != null ? product.toString() : "null") +
                ", count=" + count +
                ", fullPrice=" + getFullPrice() +
                ", isMarketingPlan=" + isMarketingPlan() +
                ", isFreeGift=" + isFreeGift() +
                '}';
    }
}
