package com.aegis.resource.material.domain;

import com.aegis.common.core.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.math.BigDecimal;
import java.util.Date;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 物资使用记录实体类 resource_material_usage
 * 
 * @author aegis
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("resource_material_usage")
public class MaterialUsage extends BaseEntity {
    
    private static final long serialVersionUID = 1L;

    /** 使用记录ID */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /** 物资ID */
    private Long materialId;

    /** 仓库ID */
    private Long warehouseId;

    /** 事件ID */
    private Long eventId;

    /** 任务ID */
    private Long taskId;

    /** 数量 */
    @DecimalMin(value = "0.00", message = "数量不能为负数")
    private BigDecimal qty;

    /** 操作类型：lock-占用，unlock-释放，consume-消耗，return-归还，adjust-调整 */
    @NotBlank(message = "操作类型不能为空")
    @Size(max = 16, message = "操作类型长度不能超过16个字符")
    private String action;

    /** 备注 */
    @Size(max = 500, message = "备注长度不能超过500个字符")
    private String remark;

    /** 创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createdAt;
}