package com.chushang.inspection.terminal.dto;

import com.chushang.common.core.validator.Create;
import com.chushang.common.core.validator.Update;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import javax.validation.constraints.Size;
import java.io.Serializable;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ConsumablesTotalDTO implements Serializable {

    /**
     * 主键
     */
    @Null(message = "id必须为空", groups = Create.class)
    @NotNull(message = "id不能为空", groups = Update.class)
    private Long totalId;

    /**
     * 耗材类型
     */
    @NotNull(message = "耗材类型不能为空", groups = {Create.class, Update.class})
    @Range(min = 1, max = 20, message = "耗材类型错误", groups = {Create.class, Update.class})
    private Integer type;

    /**
     * 总数
     */
    @NotNull(message = "入库数量不能为空", groups = {Create.class, Update.class})
    private Integer total;

    /**
     * 任务id
     */
    @NotNull(message = "任务id不能为空", groups = {Create.class, Update.class})
    private Long taskId;

    /**
     * 备注
     */
    @Size(max = 128, message = "备注不能超过128个字符", groups = {Create.class, Update.class})
    private String remark;

    /**
     * 来源
     */
    @Range(min = 1, max = 20, message = "来源输入错误", groups = {Create.class, Update.class})
    private Integer source;
}
