package com.aegis.resource.supplier.domain;

import java.util.Date;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.aegis.common.core.domain.BaseEntity;

/**
 * 供应商资质实体类 resource_supplier_license
 * 
 * @author aegis
 */
public class SupplierLicense extends BaseEntity {
    
    private static final long serialVersionUID = 1L;

    /** 资质ID */
    private Long id;

    /** 供应商ID */
    private Long supplierId;

    /** 资质类型 */
    private String licenseType;

    /** 资质编号 */
    private String licenseNo;

    /** 发证机关 */
    private String issuingAuthority;

    /** 有效期开始日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date validFrom;

    /** 有效期结束日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date validTo;

    /** 附件URL（文件ID） */
    private String attachmentUrl;

    public Long getId() {
        return id;
    }

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

    @NotNull(message = "供应商ID不能为空")
    public Long getSupplierId() {
        return supplierId;
    }

    public void setSupplierId(Long supplierId) {
        this.supplierId = supplierId;
    }

    @NotBlank(message = "资质类型不能为空")
    @Size(min = 0, max = 100, message = "资质类型长度不能超过100个字符")
    public String getLicenseType() {
        return licenseType;
    }

    public void setLicenseType(String licenseType) {
        this.licenseType = licenseType;
    }

    @Size(min = 0, max = 100, message = "资质编号长度不能超过100个字符")
    public String getLicenseNo() {
        return licenseNo;
    }

    public void setLicenseNo(String licenseNo) {
        this.licenseNo = licenseNo;
    }

    @Size(min = 0, max = 200, message = "发证机关长度不能超过200个字符")
    public String getIssuingAuthority() {
        return issuingAuthority;
    }

    public void setIssuingAuthority(String issuingAuthority) {
        this.issuingAuthority = issuingAuthority;
    }

    public Date getValidFrom() {
        return validFrom;
    }

    public void setValidFrom(Date validFrom) {
        this.validFrom = validFrom;
    }

    public Date getValidTo() {
        return validTo;
    }

    public void setValidTo(Date validTo) {
        this.validTo = validTo;
    }

    @Size(min = 0, max = 500, message = "附件URL长度不能超过500个字符")
    public String getAttachmentUrl() {
        return attachmentUrl;
    }

    public void setAttachmentUrl(String attachmentUrl) {
        this.attachmentUrl = attachmentUrl;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("supplierId", getSupplierId())
            .append("licenseType", getLicenseType())
            .append("licenseNo", getLicenseNo())
            .append("issuingAuthority", getIssuingAuthority())
            .append("validFrom", getValidFrom())
            .append("validTo", getValidTo())
            .append("attachmentUrl", getAttachmentUrl())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .append("remark", getRemark())
            .toString();
    }
}