package com.inspect.system.base.domain;

import com.inspect.base.core.annotation.Excel;
import com.inspect.base.core.annotation.Excel.ColumnType;
import com.inspect.base.core.web.domain.BaseEntity;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;

import lombok.*;

@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
public class SysDictData extends BaseEntity {
    private static final long serialVersionUID = 1L;
    @Excel(
            name = "字典编码",
            cellType = ColumnType.NUMERIC
    )
    private Long dictCode;

    @Excel(
            name = "字典排序",
            cellType = ColumnType.NUMERIC
    )
    private Long dictSort;

    @Excel(
            name = "字典标签"
    )
    private String dictLabel;
    @Excel(
            name = "字典键值"
    )
    private String dictValue;
    @Excel(
            name = "字典类型"
    )
    private String dictType;

    private String cssClass;

    private String listClass;

    @Excel(
            name = "是否默认",
            readConverterExp = "Y=是,N=否"
    )
    private String isDefault;

    @Excel(
            name = "状态",
            readConverterExp = "0=正常,1=停用"
    )
    private String status;

    @NotBlank(
            message = "字典标签不能为空"
    )
    @Size(
            min = 0,
            max = 100,
            message = "字典标签长度不能超过100个字符"
    )
    public String getDictLabel() {
        return this.dictLabel;
    }

    @NotBlank(
            message = "字典键值不能为空"
    )
    @Size(
            min = 0,
            max = 100,
            message = "字典键值长度不能超过100个字符"
    )
    public String getDictValue() {
        return this.dictValue;
    }

    public void setDictValue(String dictValue) {
        this.dictValue = dictValue;
    }

    @NotBlank(
            message = "字典类型不能为空"
    )
    @Size(
            min = 0,
            max = 100,
            message = "字典类型长度不能超过100个字符"
    )
    public String getDictType() {
        return this.dictType;
    }

    @Size(
            min = 0,
            max = 100,
            message = "样式属性长度不能超过100个字符"
    )
    public String getCssClass() {
        return this.cssClass;
    }


    public boolean getDefault() {
        return "Y".equals(this.isDefault);
    }
}
