package cn.ysk.cashier.vo;
import lombok.Data;


@Data
public class StockVo {
    private Integer id;
    private Integer proId;
    private String img;
    private String name;
    private String unitName;
    private String type;
    private String specSnap;
    private Object isStock;
    private Object number;
    private Object stockNumber;

    public StockVo(Integer id,String name,String unitName,String specSnap, Object number,Object stockNumber) {
        this.id = id;
        this.unitName = unitName;
        this.specSnap = specSnap;
        this.name = name;
        this.number = number;
        this.stockNumber = stockNumber;
    }

    public StockVo(Integer id, Integer proId,String img,String name,String unitName, String type, String specSnap, Object isStock, Object number) {
        this.id = id;
        this.proId = proId;
        this.img = img;
        this.name = name;
        this.unitName = unitName;
        setType(type);
        this.specSnap = specSnap;
        this.isStock = isStock;
        this.number = number;
    }

    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 + "\"" +
                "}";
    }
}
