package com.aegis.resource.procurement.domain;

import java.math.BigDecimal;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.aegis.common.core.domain.BaseEntity;

/**
 * 采购明细实体类 resource_procurement_item
 * 
 * @author aegis
 */
public class ProcurementItem extends BaseEntity {
    
    private static final long serialVersionUID = 1L;

    /** 明细ID */
    private Long id;

    /** 采购申请ID */
    private Long procurementId;

    /** 分类：material-物资，equipment-装备 */
    private String category;

    /** 规格描述 */
    private String spec;

    /** 数量 */
    private BigDecimal qty;

    /** 单位 */
    private String unit;

    /** 是否可重复使用：0-否，1-是 */
    private Integer isReusable;

    /** 目标物资ID（入库时关联） */
    private Long targetMaterialId;

    /** 目标物资名称（关联查询，不持久化） */
    private transient String targetMaterialName;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @NotNull(message = "采购申请ID不能为空")
    public Long getProcurementId() {
        return procurementId;
    }

    public void setProcurementId(Long procurementId) {
        this.procurementId = procurementId;
    }

    @NotBlank(message = "分类不能为空")
    @Size(min = 0, max = 16, message = "分类长度不能超过16个字符")
    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    @Size(min = 0, max = 500, message = "规格描述长度不能超过500个字符")
    public String getSpec() {
        return spec;
    }

    public void setSpec(String spec) {
        this.spec = spec;
    }

    @NotNull(message = "数量不能为空")
    public BigDecimal getQty() {
        return qty;
    }

    public void setQty(BigDecimal qty) {
        this.qty = qty;
    }

    @Size(min = 0, max = 16, message = "单位长度不能超过16个字符")
    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public Integer getIsReusable() {
        return isReusable;
    }

    public void setIsReusable(Integer isReusable) {
        this.isReusable = isReusable;
    }

    public Long getTargetMaterialId() {
        return targetMaterialId;
    }

    public void setTargetMaterialId(Long targetMaterialId) {
        this.targetMaterialId = targetMaterialId;
    }

    public String getTargetMaterialName() {
        return targetMaterialName;
    }

    public void setTargetMaterialName(String targetMaterialName) {
        this.targetMaterialName = targetMaterialName;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("procurementId", getProcurementId())
            .append("category", getCategory())
            .append("spec", getSpec())
            .append("qty", getQty())
            .append("unit", getUnit())
            .append("isReusable", getIsReusable())
            .append("targetMaterialId", getTargetMaterialId())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .append("remark", getRemark())
            .toString();
    }
}