package com.slodon.b2b2c.vo.goods;

import com.slodon.b2b2c.core.util.FileUrlUtil;
import com.slodon.b2b2c.core.util.StringUtil;
import com.slodon.b2b2c.goods.pojo.GoodsCategory;
import com.slodon.b2b2c.seller.pojo.StoreBindCategory;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * 封装front端商品分类列表VO对象
 */
@NoArgsConstructor
@Data
public class FrontGoodsCategoryVO {

    @ApiModelProperty("分类id")
    private Integer categoryId;

    @ApiModelProperty("站点")
    private String webSite;

    @ApiModelProperty("分类名称")
    private String categoryName;

    @ApiModelProperty("父类ID")
    private Integer pid;

    @ApiModelProperty("分类级别: 1-一级，2-二级，3-三级")
    private Integer grade;

    @ApiModelProperty("移动端分类图片路径")
    private String categoryImage;

    @ApiModelProperty("移动端图片（仅在一级分类使用）")
    private String mobileImage;

    @ApiModelProperty("子分类列表")
    private List<FrontGoodsCategoryVO> children;

    @ApiModelProperty("首页显示")
    private Integer homeShow;

    @ApiModelProperty("seoInfo")
    private SysSeoVO seoInfo;

    public FrontGoodsCategoryVO(GoodsCategory category) {
        this.categoryId = category.getCategoryId();
        this.webSite = category.getWebSite();
        this.categoryName = category.getCategoryName();
        this.pid = category.getPid();
        this.grade = category.getGrade();
        this.categoryImage = FileUrlUtil.getFileUrl(category.getCategoryImage(), null);
        this.mobileImage = category.getMobileImage();
        this.homeShow = category.getHomeShow();
    }
}