package com.jeeplus.assess.invoice.domain.OMS;

import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.Pattern;


/**
 * 附加要素信息(按需传值，如果不为空则在发票备注展示附加要素信息;仅对开票类型为蓝票且发票类型为电子发票(增值税专用发票)、电子发票(普通发票)生效)
 */
public class Additional {
    /**
     * 附加要素名称
     * 必填，40个字节（一个汉字占2个字节）
     */
    @NotBlank(message = "附加要素名称additionalName不能为空")
    private String additionalName;

    /**
     * 附加要素类型
     * 必填，可选值：string(字符型)、number(数值型)、date(日期型，格式yyyy-mm-dd)
     */
    @NotBlank(message = "附加要素类型additionalType不能为空")
    @Pattern(regexp = "^string|number|date$",
            message = "附加要素类型additionalType只能传入：string(字符型)、number(数值型)、date(日期型)")
    private String additionalType;

    /**
     * 附加要素值
     * 必填，500个字节
     * 若类型为date时，格式必须为yyyy-mm-dd
     */
    @NotBlank(message = "附加要素值additionalValue不能为空")
    @Pattern(regexp = "^$|^\\d{4}-\\d{2}-\\d{2}$",
            message = "当附加要素类型为date时，值的格式必须为yyyy-mm-dd")
    private String additionalValue;

    public String getAdditionalName() {
        return additionalName;
    }

    public void setAdditionalName(String additionalName) {
        this.additionalName = additionalName;
    }

    public String getAdditionalType() {
        return additionalType;
    }

    public void setAdditionalType(String additionalType) {
        this.additionalType = additionalType;
    }

    public String getAdditionalValue() {
        return additionalValue;
    }

    public void setAdditionalValue(String additionalValue) {
        this.additionalValue = additionalValue;
    }
}
