package com.njcn.gather.aireport.testreportmulti.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.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.util.StringUtils;

import java.time.LocalDateTime;

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

    @ApiModelProperty("多模板批任务ID")
    private String id;
    @ApiModelProperty("批任务编号")
    private String no;
    @ApiModelProperty("压缩包文件名")
    private String zipFileName;
    @ApiModelProperty("台账汇总文件名")
    private String summaryFileName;
    @ApiModelProperty("模板目录数量")
    private Integer dirCount;
    @ApiModelProperty("子报告数量")
    private Integer childReportCount;
    @ApiModelProperty("监测点总数")
    private Integer pointCount;
    @ApiModelProperty("导入状态")
    private Integer importState;
    @ApiModelProperty("整体生成状态")
    private Integer generateState;
    @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 getZipFileName() {
        return defaultDisplay(zipFileName);
    }

    public String getSummaryFileName() {
        return defaultDisplay(summaryFileName);
    }

    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;
    }
}
