package com.njcn.gather.aireport.testreport.pojo.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.util.StringUtils;

import java.time.LocalDate;
import java.time.LocalDateTime;

@Data
public class TestReportVO {
    private static final String DEFAULT_EMPTY_DISPLAY = "-";

    @ApiModelProperty("普测报告ID")
    private String id;
    @ApiModelProperty("普测报告编号")
    private String no;
    @ApiModelProperty("委托单位ID")
    private String clientUnitId;
    @ApiModelProperty("委托单位名称")
    private String clientUnitName;
    @ApiModelProperty("报告模板ID")
    private String reportModelId;
    @ApiModelProperty("报告模板名称")
    private String reportModelName;
    @ApiModelProperty("检测公司ID")
    private String createUnit;
    @ApiModelProperty("合同编号")
    private String contractNumber;
    @ApiModelProperty("检测依据")
    private String standard;
    @ApiModelProperty("受资数据")
    private String data;
    @ApiModelProperty("联系电话")
    private String phonenumber;
    @ApiModelProperty("审核人ID")
    private String checkId;
    @ApiModelProperty("审核人名称")
    private String checkerName;
    @ApiModelProperty("审核时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @JsonDeserialize(using = LocalDateDeserializer.class)
    @JsonSerialize(using = LocalDateSerializer.class)
    private LocalDate checkTime;
    @ApiModelProperty("审核意见")
    private String checkResult;
    @ApiModelProperty("报告状态")
    private String state;
    @ApiModelProperty("报告生成状态")
    private Integer reportGenerateState;
    @ApiModelProperty("监测点数量")
    private Integer pointCount;
    @ApiModelProperty("分组数量")
    private Integer groupCount;
    @ApiModelProperty("逻辑状态")
    private Integer status;
    @ApiModelProperty("创建人显示名")
    private String createBy;
    @ApiModelProperty("创建人名称")
    private String createByName;
    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime createTime;
    @ApiModelProperty("更新人显示名")
    private String updateBy;
    @ApiModelProperty("更新人名称")
    private String updateByName;
    @ApiModelProperty("更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime updateTime;

    public String getId() {
        return defaultDisplay(id);
    }

    public String getNo() {
        return defaultDisplay(no);
    }

    public String getClientUnitId() {
        return defaultDisplay(clientUnitId);
    }

    public String getClientUnitName() {
        return defaultDisplay(clientUnitName);
    }

    public String getReportModelId() {
        return defaultDisplay(reportModelId);
    }

    public String getReportModelName() {
        return defaultDisplay(reportModelName);
    }

    public String getCreateUnit() {
        return defaultDisplay(createUnit);
    }

    public String getContractNumber() {
        return defaultDisplay(contractNumber);
    }

    public String getStandard() {
        return defaultDisplay(standard);
    }

    public String getData() {
        return defaultDisplay(data);
    }

    public String getPhonenumber() {
        return defaultDisplay(phonenumber);
    }

    public String getCheckId() {
        return defaultDisplay(checkId);
    }

    public String getCheckerName() {
        return defaultDisplay(checkerName);
    }

    public String getCheckResult() {
        return defaultDisplay(checkResult);
    }

    public String getState() {
        return defaultDisplay(state);
    }

    public String getCreateBy() {
        return defaultDisplay(createBy);
    }

    public String getCreateByName() {
        return defaultDisplay(createByName);
    }

    public String getUpdateBy() {
        return defaultDisplay(updateBy);
    }

    public String getUpdateByName() {
        return defaultDisplay(updateByName);
    }

    private String defaultDisplay(String value) {
        return StringUtils.hasText(value) ? value : DEFAULT_EMPTY_DISPLAY;
    }
}
