package com.wzj.soopin.goods.domain.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.ibatis.type.JdbcType;

import java.math.BigDecimal;

/**
 * 商品信息
 */
@Schema(description = "商品信息")
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "wzj_soopin.pms_product_snapshot")
public class ProductSnapshot {
    /**
     * 主键id
     */
    @TableId(value = "id")
    @Schema(description = "主键id")
    private Long id;

    /**
     * 商品id
     */
    @TableField(value = "product_id")
    @Schema(description = "商品id")
    private Long productId;

    /**
     * 品牌id
     */
    @TableField(value = "brand_id")
    @Schema(description = "品牌id")
    private Long brandId;

    /**
     * 分类id
     */
    @TableField(value = "category_id")
    @Schema(description = "分类id")
    private Long categoryId;

    /**
     * 商品编码
     */
    @TableField(value = "out_product_id")
    @Schema(description = "商品编码")
    @Size(max = 64, message = "商品编码最大长度要小于 64")
    private String outProductId;

    /**
     * 商品名称
     */
    @TableField(value = "`name`")
    @Schema(description = "商品名称")
    @Size(max = 64, message = "商品名称最大长度要小于 64")
    @NotBlank(message = "商品名称不能为空")
    private String name;

    /**
     * 主图
     */
    @TableField(value = "pic")
    @Schema(description = "主图")
    @Size(max = 255, message = "主图最大长度要小于 255")
    private String pic;

    /**
     * 画册图片，连产品图片限制为5张，以逗号分割
     */
    @TableField(value = "album_pics")
    @Schema(description = "画册图片，连产品图片限制为5张，以逗号分割")
    @Size(max = 1000, message = "画册图片，连产品图片限制为5张，以逗号分割最大长度要小于 1000")
    private String albumPics;

    /**
     * 排序
     */
    @TableField(value = "sort")
    @Schema(description = "排序")
    private Integer sort;

    /**
     * 价格
     */
    @TableField(value = "price")
    @Schema(description = "价格")
    private BigDecimal price;

    /**
     * 单位
     */
    @TableField(value = "unit")
    @Schema(description = "单位")
    @Size(max = 16, message = "单位最大长度要小于 16")
    private String unit;

    /**
     * 商品重量，默认为克
     */
    @TableField(value = "weight")
    @Schema(description = "商品重量，默认为克")
    private BigDecimal weight;

    /**
     * 产品详情网页内容
     */
    @TableField(value = "detail_html")
    @Schema(description = "产品详情网页内容")
    private String detailHtml;

    /**
     * 移动端网页详情
     */
    @TableField(value = "detail_mobile_html")
    @Schema(description = "移动端网页详情")
    private String detailMobileHtml;

    /**
     * 品牌名称
     */
    @TableField(value = "brand_name")
    @Schema(description = "品牌名称")
    @Size(max = 255, message = "品牌名称最大长度要小于 255")
    private String brandName;

    /**
     * 商品分类名称
     */
    @TableField(value = "product_category_name")
    @Schema(description = "商品分类名称")
    @Size(max = 255, message = "商品分类名称最大长度要小于 255")
    private String productCategoryName;

    /**
     * 商品销售属性，json格式
     */
    @TableField(value = "product_attr")
    @Schema(description = "商品销售属性，json格式")
    @Size(max = 500, message = "商品销售属性，json格式最大长度要小于 500")
    private String productAttr;

    /**
     * 租户id
     */
    @TableField(value = "tenant_id")
    @Schema(description = "租户id")
    @Size(max = 255, message = "租户id最大长度要小于 255")
    private String tenantId;

    @Schema(description = "删除标志（0代表存在，1代表删除）")
    @TableLogic(value ="0", delval = "1")
    @TableField(value ="del_flag",fill = FieldFill.INSERT, jdbcType = JdbcType.CHAR)
    private String delFlag;
}
