package cn.ysk.cashier.vo;

import lombok.Data;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author GYJ
 */
public class StockV2Vo {
    private String id;
    private Integer skuId;
    private Integer proId;
    private String img;
    private String name;
    private String unitName;
    private String type;
    private String specSnap;
    private Object isStock;
    private Object stockNumber;
    private Integer isDistribute;
    private Integer isPauseSale;
    private Object number;
    private Integer warnLine;
    private BigDecimal salePrice;
    private boolean isGrounding;

    public StockV2Vo(Integer proId, Integer skuId, String name, String unitName,String specSnap, Object number,Object stockNumber, Integer isDistribute) {
        this.proId = proId;
        this.skuId = skuId;
        this.name = name;
        this.unitName = unitName;
        this.specSnap = specSnap;
        this.number = number;
        this.stockNumber = stockNumber;
        this.isDistribute = isDistribute;
    }

    public StockV2Vo(Integer id, Integer proId,String img,String name,String unitName, String type, String specSnap,
                     Object isStock, Object number, Integer isDistribute, Integer isPauseSale, boolean isPro) {
        this.id = id.toString() + "-" + proId.toString();
        if (isPro) {
            this.id += proId;
        } else {
            this.id += id;
        }
        this.skuId = id;
        this.proId = proId;
        this.img = img;
        this.name = name;
        this.unitName = unitName;
        setType(type);
        this.specSnap = specSnap;
        this.isStock = isStock;
        this.stockNumber = number;
        this.isDistribute = isDistribute;
        this.isPauseSale = isPauseSale;
    }

    public StockV2Vo(Integer id, Integer proId,String img,String name,String unitName, String type, String specSnap,
                     Object isStock, Object number, Integer isDistribute, Integer isPauseSale, boolean isPro, Integer warnLine) {
        this.id = id.toString() + "-" + proId.toString();
        if (isPro) {
            this.id += proId;
        } else {
            this.id += id;
        }
        this.skuId = id;
        this.proId = proId;
        this.img = img;
        this.name = name;
        this.unitName = unitName;
        setType(type);
        this.specSnap = specSnap;
        this.isStock = isStock;
        this.stockNumber = number;
        this.isDistribute = isDistribute;
        this.isPauseSale = isPauseSale;
        this.warnLine = warnLine;
    }


    public StockV2Vo(Integer id, Integer proId,String img,String name,String unitName, String type, String specSnap,
                     Object isStock, Object number, Integer isDistribute, Integer isPauseSale, boolean isPro, Integer warnLine, BigDecimal sellPrice) {
        this.id = id.toString() + "-" + proId.toString();
        if (isPro) {
            this.id += proId;
        } else {
            this.id += id;
        }
        this.skuId = id;
        this.proId = proId;
        this.img = img;
        this.name = name;
        this.unitName = unitName;
        setType(type);
        this.specSnap = specSnap;
        this.isStock = isStock;
        this.stockNumber = number;
        this.isDistribute = isDistribute;
        this.isPauseSale = isPauseSale;
        this.warnLine = warnLine;
        this.salePrice = sellPrice;
    }



    public StockV2Vo(Integer id, Integer proId,String img,String name,String unitName, String type, String specSnap,
                     Object isStock, Object number, Integer isDistribute, Integer isPauseSale, boolean isPro, Integer warnLine, BigDecimal sellPrice, boolean isGrounding) {
        this.skuId = id;
        this.id = id.toString() + "-" + proId.toString();
        if (isPro) {
            this.id += proId;
        } else {
            this.id += id;
        }
        this.proId = proId;
        this.img = img;
        this.name = name;
        this.unitName = unitName;
        setType(type);
        this.specSnap = specSnap;
        this.isStock = isStock;
        this.stockNumber = number;
        this.isDistribute = isDistribute;
        this.isPauseSale = isPauseSale;
        this.warnLine = warnLine;
        this.salePrice = sellPrice;
        this.isGrounding = isGrounding;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Integer getSkuId() {
        return skuId;
    }

    public void setSkuId(Integer skuId) {
        this.skuId = skuId;
    }

    public Integer getProId() {
        return proId;
    }

    public void setProId(Integer proId) {
        this.proId = proId;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUnitName() {
        return unitName;
    }

    public void setUnitName(String unitName) {
        this.unitName = unitName;
    }

    public String getType() {
        return type;
    }

    public String getSpecSnap() {
        return specSnap;
    }

    public void setSpecSnap(String specSnap) {
        this.specSnap = specSnap;
    }

    public Object getIsStock() {
        return isStock;
    }

    public void setIsStock(Object isStock) {
        this.isStock = isStock;
    }

    public Object getStockNumber() {
        return stockNumber;
    }

    public void setStockNumber(Object stockNumber) {
        this.stockNumber = stockNumber;
    }

    public Integer getIsDistribute() {
        return isDistribute;
    }

    public void setIsDistribute(Integer isDistribute) {
        this.isDistribute = isDistribute;
    }

    public Integer getIsPauseSale() {
        return isPauseSale;
    }

    public void setIsPauseSale(Integer isPauseSale) {
        this.isPauseSale = isPauseSale;
    }

    public Object getNumber() {
        return number;
    }

    public void setNumber(Object number) {
        this.number = number;
    }

    public Integer getWarnLine() {
        return warnLine;
    }

    public void setWarnLine(Integer warnLine) {
        this.warnLine = warnLine;
    }

    public BigDecimal getSalePrice() {
        return salePrice;
    }

    public void setSalePrice(BigDecimal salePrice) {
        this.salePrice = salePrice;
    }

    public boolean getIsGrounding() {
        return isGrounding;
    }

    public void setIsGrounding(boolean grounding) {
        isGrounding = grounding;
    }

    public void setType(String type) {
        switch (type) {
            case "normal":
                this.type = "单规格";
                break;
            case "sku":
                this.type = "多规格";
                break;
            case "weight":
                this.type = "称重商品";
                break;
            case "currentPrice":
                this.type = "时价商品";
                break;
            case "group":
                this.type = "套餐商品/团购卷";
                break;
            default:
                this.type = type;
                break;
        }
    }

    @Override
    public String toString() {
        return "{" +
                "\"name\":\"" + name + "\","+
                "\"unitName\":\"" + unitName +"\","+
                "\"specSnap\":\"" + specSnap + "\"," +
                "\"number\":\"" + number + "\"," +
                "\"stockNumber\":\"" + stockNumber + "\"" +
                "}";
    }
}
