package com.xinelu.manage.domain.goodsInfo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.xinelu.common.annotation.Excel;
import com.xinelu.common.core.domain.BaseDomain;
import com.xinelu.common.custominterface.Insert;
import com.xinelu.common.custominterface.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;


/**
 * 商品基本信息对象 goods_info
 *
 * @author xinyilu
 * @date 2022-10-17
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "商品基本信息对象", description = "goods_info")
public class GoodsInfo extends BaseDomain implements Serializable {
    private static final long serialVersionUID = 5311374556313294992L;
    /**
     * 主键id
     */
    @NotNull(message = "商品id不能为空！", groups = {Update.class})
    private Long id;

    /**
     * 店铺表id
     */
    @ApiModelProperty(value = "店铺表id")
    @Excel(name = "店铺表id")
    private Long storeInfoId;

    /**
     * 护理站id，冗余字段
     */
    @ApiModelProperty(value = "护理站id，冗余字段")
    @Excel(name = "护理站id，冗余字段")
    private Long nurseStationId;

    /**
     * 商品分类id
     */
    @ApiModelProperty(value = "商品分类id")
    @Excel(name = "商品分类id")
    @NotNull(message = "商品分类信息不能为空！", groups = {Insert.class, Update.class})
    private Long goodsCategoryId;

    /**
     * 商品名称
     */
    @ApiModelProperty(value = "商品名称")
    @Excel(name = "商品名称")
    @NotBlank(message = "商品名称信息不能为空！", groups = {Insert.class, Update.class})
    private String goodsName;

    /**
     * 商品编码
     */
    @ApiModelProperty(value = "商品编码")
    @Excel(name = "商品编码")
    private String goodsCode;

    /**
     * 是否上架，0：否，1：是
     */
    @ApiModelProperty(value = "是否上架，0：否，1：是")
    @Excel(name = "是否上架，0：否，1：是")
    private Integer whetherShelf;

    /**
     * 上架时间，yyyy-MM-dd HH:mm:ss
     */
    @ApiModelProperty(value = "上架时间，yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "上架时间，yyyy-MM-dd HH:mm:ss", width = 30, dateFormat = "yyyy-MM-dd")
    private LocalDateTime shelfTime;

    /**
     * 商品图片路径
     */
    @ApiModelProperty(value = "商品图片路径")
    @Excel(name = "商品图片路径")
    @NotBlank(message = "商品图片路径不能为空！", groups = {Insert.class, Update.class})
    private String goodsPictureUrl;

    /**
     * 商品概述
     */
    @ApiModelProperty(value = "商品概述")
    @Excel(name = "商品概述")
    private String goodsRemark;

    /**
     * 商品度量单位
     */
    @ApiModelProperty(value = "商品度量单位")
    @Excel(name = "商品度量单位")
    @NotBlank(message = "商品度量单位不能为空！", groups = {Insert.class, Update.class})
    private String goodsUnit;

    /**
     * 商品用途，买卖：BUSINESS，租赁：LEASE
     */
    @ApiModelProperty(value = "商品用途，买卖：BUSINESS，租赁：LEASE")
    @Excel(name = "商品用途，买卖：BUSINESS，租赁：LEASE")
    @NotBlank(message = "商品用途不能为空！", groups = {Insert.class, Update.class})
    private String goodsPurpose;

    /**
     * 显示顺序
     */
    @ApiModelProperty(value = "显示顺序")
    @Excel(name = "显示顺序")
    @NotNull(message = "商品显示顺序不能为空！", groups = {Insert.class, Update.class})
    private Integer sort;

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("storeInfoId", getStoreInfoId())
                .append("nurseStationId", getNurseStationId())
                .append("goodsCategoryId", getGoodsCategoryId())
                .append("goodsName", getGoodsName())
                .append("goodsCode", getGoodsCode())
                .append("whetherShelf", getWhetherShelf())
                .append("shelfTime", getShelfTime())
                .append("goodsPictureUrl", getGoodsPictureUrl())
                .append("goodsRemark", getGoodsRemark())
                .append("goodsUnit", getGoodsUnit())
                .append("goodsPurpose", getGoodsPurpose())
                .append("sort", getSort())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .toString();
    }
}
