package ink.wgink.module.dictionary.pojo.dtos;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: DataDTO
 * @Description: 字典
 * @Author: WangGeng
 * @Date: 2019/11/18 14:17
 * @Version: 1.0
 **/
@ApiModel
public class DataDTO implements Serializable {

    @ApiModelProperty(name = "dataId", value = "字典ID")
    private String dataId;
    @ApiModelProperty(name = "dataParentId", value = "字典上级ID")
    private String dataParentId;
    @ApiModelProperty(name = "dataParentName", value = "字典上级名称")
    private String dataParentName;
    @ApiModelProperty(name = "isParent", value = "是否父级")
    private Boolean isParent;
    @ApiModelProperty(name = "dataName", value = "字典名称")
    private String dataName;
    @ApiModelProperty(name = "dataSummary", value = "字典说明")
    private String dataSummary;
    @ApiModelProperty(name = "dataCode", value = "字典编码")
    private String dataCode;
    @ApiModelProperty(name = "dataSort", value = "字典排序")
    private String dataSort;
    @ApiModelProperty(name = "subData", value = "子字典列表")
    private List<DataDTO> subData;

    public String getDataId() {
        return dataId == null ? "" : dataId;
    }

    public void setDataId(String dataId) {
        this.dataId = dataId;
    }

    public String getDataParentId() {
        return dataParentId == null ? "" : dataParentId;
    }

    public void setDataParentId(String dataParentId) {
        this.dataParentId = dataParentId;
    }

    public String getDataParentName() {
        return dataParentName == null ? "" : dataParentName;
    }

    public void setDataParentName(String dataParentName) {
        this.dataParentName = dataParentName;
    }

    public Boolean getParent() {
        return isParent;
    }

    public void setParent(Boolean parent) {
        isParent = parent;
    }

    public String getDataName() {
        return dataName == null ? "" : dataName;
    }

    public void setDataName(String dataName) {
        this.dataName = dataName;
    }

    public String getDataSummary() {
        return dataSummary == null ? "" : dataSummary;
    }

    public void setDataSummary(String dataSummary) {
        this.dataSummary = dataSummary;
    }

    public String getDataCode() {
        return dataCode == null ? "" : dataCode;
    }

    public void setDataCode(String dataCode) {
        this.dataCode = dataCode;
    }

    public String getDataSort() {
        return dataSort == null ? "" : dataSort.trim();
    }

    public void setDataSort(String dataSort) {
        this.dataSort = dataSort;
    }

    public List<DataDTO> getSubData() {
        if (subData == null) {
            return new ArrayList<>();
        }
        return subData;
    }

    public void setSubData(List<DataDTO> subData) {
        this.subData = subData;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("\"dataId\":")
                .append("\"").append(dataId).append("\"");
        sb.append(",\"dataParentId\":")
                .append("\"").append(dataParentId).append("\"");
        sb.append(",\"dataParentName\":")
                .append("\"").append(dataParentName).append("\"");
        sb.append(",\"isParent\":")
                .append(isParent);
        sb.append(",\"dataName\":")
                .append("\"").append(dataName).append("\"");
        sb.append(",\"dataSummary\":")
                .append("\"").append(dataSummary).append("\"");
        sb.append(",\"dataCode\":")
                .append("\"").append(dataCode).append("\"");
        sb.append(",\"dataSort\":")
                .append("\"").append(dataSort).append("\"");
        sb.append(",\"subData\":")
                .append(subData);
        sb.append('}');
        return sb.toString();
    }
}
