package com.slodon.b2b2c.vo.goods;

import com.slodon.b2b2c.core.util.FileUrlUtil;
import com.slodon.b2b2c.goods.pojo.Goods;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;

/**
 *
 * 封装店铺商品导入列表VO对象
 * @author wuxy
 * @date 2021.10.26 11:14
 */
@Data
public class StoreGoodsVO {

    @ApiModelProperty("商品ID")
    private Long goodsId;

    @ApiModelProperty("商品名称")
    private String goodsName;

    @ApiModelProperty("品牌ID")
    private Integer brandId;

    @ApiModelProperty("品牌名称")
    private String brandName;

    @ApiModelProperty("1级分类ID")
    private Integer categoryId1;

    @ApiModelProperty("2级分类ID")
    private Integer categoryId2;

    @ApiModelProperty("3级分类ID")
    private Integer categoryId3;

    @ApiModelProperty("商品所属分类路径")
    private String categoryPath;

    @ApiModelProperty("商品价格")
    private BigDecimal goodsPrice;

    @ApiModelProperty("商品主图路径，每个SPU一张主图")
    private String mainImage;

    @ApiModelProperty("商品条形码（标准的商品条形码）")
    private String barCode;

    @ApiModelProperty("店铺ID")
    private Long storeId;

    @ApiModelProperty("店铺名称")
    private String storeName;

    @ApiModelProperty("货品id")
    private Long productId;

    @ApiModelProperty("是否是虚拟商品：1-实物商品；2-虚拟商品")
    private Integer isVirtualGoods;

    public StoreGoodsVO(Goods goods) {
        this.goodsId = goods.getGoodsId();
        this.goodsName = goods.getGoodsName();
        this.brandId = goods.getBrandId();
        this.brandName = goods.getBrandName();
        this.categoryId1 = goods.getCategoryId1();
        this.categoryId2 = goods.getCategoryId2();
        this.categoryId3 = goods.getCategoryId3();
        this.categoryPath = goods.getCategoryPath();
        this.goodsPrice = goods.getGoodsPrice();
        this.mainImage = FileUrlUtil.getFileUrl(goods.getMainImage(), null);
        this.barCode = goods.getBarCode();
        this.storeId = goods.getStoreId();
        this.storeName = goods.getStoreName();
        this.productId = goods.getDefaultProductId();
        this.isVirtualGoods = goods.getIsVirtualGoods();
    }

}
