package cn.ysk.cashier.vo;

import cn.ysk.cashier.cons.domain.ViewConSku;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.Column;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;

/**
 * @author ww
 */
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class TbProductNewVo {

    private Integer id;
    //店铺id
    private String shopId;
    //图片
    private String coverImg;
    //商品名称
    private String name;
    //售价
    private String lowPrice;
    //类型 单规格/多规格
    private String typeEnum;
    //库存
    private Double stockNumber;
    //上下架 0否1是
    private Integer isGrounding;
    //是否售罄 0否1是
    private Integer isPauseSale;

    private List<ViewConSku> conInfos;

    private List<TbProductSkuVos> skuList = new ArrayList<>();

    //退款是否退回库存
    private Integer isRefundStock = 1;

    private Integer isSaveSku = 1;

    //库存警戒线
    private Integer warnLine = 0;

    //排序
    private Integer sort;

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

    @Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class TbProductSkuVos {
        private Integer id;
        private String name;
        private String lowPrice;
        private Integer isPauseSale;
        private Integer isGrounding;
    }
}
