package com.bonus.material.part.domain;

import com.bonus.common.core.annotation.Excel;
import com.bonus.common.core.web.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 配件类型对象 ma_part_type
 * @author hongchao
 */
@EqualsAndHashCode(callSuper = false)
@Data
@ToString
public class PartTypeDto extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /** 类型ID */
    @ApiModelProperty(value = "类型ID")
    private Long partId;

    @NotBlank(message = "名称不能为空")
    @Size(max=30, message = "名称长度不能超过30")
    private String partName;


    /** 上级ID */
    @ApiModelProperty(value = "上级ID")
    private Long parentId;

    /** 实时库存 */
    @Excel(name = "实时库存")
    @ApiModelProperty(value = "实时库存")
    private BigDecimal storageNum;

    /** 类型编号 */
    @ApiModelProperty(value = "类型编号")
    private String typeCode;

    /** 规格编号 */
    @ApiModelProperty(value = "规格编号")
    private String modelCode;

    /** 计量单位ID */
    @ApiModelProperty(value = "计量单位ID")
    private Long unitId;

    /** 计量单位名称 */
    @ApiModelProperty(value = "计量单位名称")
    @Excel(name = "计量单位")
    private String unitName;


    /** 排序 */
    @ApiModelProperty(value = "排序")
    @Excel(name = "排序")
    private int sortNum;


    /** 租赁费用生效时间 */
    @ApiModelProperty(value = "租赁费用生效时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "租赁费用生效时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date effTime;

    /** 租赁单价 */
    @Excel(name = "租赁单价")
    @ApiModelProperty(value = "租赁单价")
    private BigDecimal rentPrice;

    /** 采购价原值 */
    @Excel(name = "采购价原值")
    @ApiModelProperty(value = "采购价原值")
    private BigDecimal buyPrice;


    /** 税率 */
    @ApiModelProperty(value = "税率")
    private BigDecimal taxRatio;

    /** 层级 */
    @ApiModelProperty(value = "层级")
    private String level;


    /** 库存预警数量 */
    @Excel(name = "库存预警数量")
    @ApiModelProperty(value = "库存预警数量")
    private Long warnNum;

    /** 删除标志（0代表存在 2代表删除） */
    private String delFlag;

    private String keyword;

    /** 子节点 */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<PartTypeDto> children = new ArrayList<>();

}
