package cn.cecep.talroad.vo;

import cn.cecep.talroad.common.core.annotation.Excel;
import cn.cecep.talroad.domain.AmProblemFiVideo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import java.util.Date;
import java.util.List;
import java.util.Map;

@ApiModel(value = "预警报警信息")
@EqualsAndHashCode(callSuper = false)
@Data
public class AmProblemFiVo
{

    @ApiModelProperty(value = "主键id")
    private String id;

    @ApiModelProperty(value = "问题来源 1:关联分析系统, 2:分表计电系统, 3:动态管控系统")
    @Excel(name = "问题来源", readConverterExp = "1=关联分析系统,2=分表计电系统,3=动态管控系统")
    private String problemSources;

    @ApiModelProperty(value = "问题分类 关联pc_ra_problem_type表主键", hidden = true)
    private String problemType;

    @Excel(name = "问题分类")
    @ApiModelProperty(value = "问题分类名称")
    private String problemTypeName;

    @ApiModelProperty(value = "企业id")
    private String factoryId;

    @Excel(name = "企业名称")
    @ApiModelProperty(value = "企业名称")
    private String factoryName;

    @Excel(name = "区域")
    @ApiModelProperty(value = "区域")
    private String regionName;

    @Excel(name = "行业")
    @ApiModelProperty(value = "行业名称")
    private String industryName;

    @Excel(name = "监测点位名称")
    @ApiModelProperty(value = "监测点位名称")
    private String stationName;

    @Excel(name = "分析开始时间")
    @ApiModelProperty(value = "分析时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date analyseTime;

    @Excel(name = "分析结束时间")
    @ApiModelProperty(value = "分析时间结束")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date analyseTimeEnd;

    @Excel(name = "参数名称")
    @ApiModelProperty(value = "参数名称")
    private String paramName;

    @Excel(name = "问题说明")
    @ApiModelProperty(value = "问题说明")
    private String problemDetails;

    @ApiModelProperty(value = "反馈时间")
    private String feedbackDate;

    @ApiModelProperty(value = "反馈描述")
    private String feedbackDesc;

    @ApiModelProperty(value = "详情跳转路由")
    private String route;

    @ApiModelProperty(value = "状态 1:查看, 2:验证")
    private String status;

    @ApiModelProperty(value = "问题状态:100：初始化/待签收，200：待整改，300：待审核，400：审核不通过，500：已办结/已签收")
    private String problemStatus;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "整改期限开始时间")
    private Date rectifyLimitStartTime;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "整改期限结束时间")
    private Date rectifyLimitEndTime;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "整改完成时间")
    private Date rectifyTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "签收完成时间")
    private Date signTime;

    @ApiModelProperty(value = "问题审核人类型：1：值守，2：执法")
    private String problemAuditType;

    private Integer rectifyLimitSum;

    @ApiModel(value = "预警报警详情")
    @Data
    public static class Detail extends AmProblemFiVo {
        @ApiModelProperty(value = "监测点位id。可能是排口id、设备id，根据问题分类判断")
        private String stationId;

        @ApiModelProperty(value = "参数名称对应的类属性。气排口在线监测物属性见SEnvGasMonReal类，水排口在线监测属性见SEnvWaterMonReal类，工况数据监测属性见bas_param表param_code_svc字段")
        private String paramProperty;

        @ApiModelProperty(value = "类型 0-预警，1-报警")
        private Integer type;

        @ApiModelProperty(value = "模型分析结果验证-备注说明")
        private String modelValidDetails;

        @ApiModelProperty(value = "模型分析结果验证-反馈人")
        private String modelValidPerson;

        @ApiModelProperty(value = "模型分析结果验证-办理时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private Date modelValidTime;

        @ApiModelProperty(value = "模型分析结果验证-数据库问题真假")
        private String modelValidDb;

        @ApiModelProperty(value = "模型分析结果验证-数据库问题真假")
        private String modelValidVideo;

        @ApiModelProperty(value = "监控视频截图")
        private List<AmProblemFiVideo.Vo> videoPictures;

        @ApiModelProperty(value = "监控视频回放")
        private List<AmProblemFiVideo.Vo> videos;

        @ApiModelProperty("AI输入数据开始时间")
        private String inputStartTime;

        @ApiModelProperty("AI输入数据结束时间")
        private String inputEndTime;

        @ApiModelProperty(value = "污染要素分类名称")
        private String pollutionTypeName;

        @ApiModelProperty(value = "问题原因说明")
        private String problemCause;
        @ApiModelProperty(value = "问题原因附件")
        private String problemCauseFile;
        @ApiModelProperty(value = "问题原因时间")
        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date problemCauseTime;
    }

    @ApiModel(value = "模型分析结果验证保存表单")
    @Data
    public static class ModelValidForm {
        @ApiModelProperty(value = "主键id")
        private String id;

        @NotBlank(message = "数据库问题真假不可以为空")
        @ApiModelProperty(value = "模型分析结果验证-数据库问题真假 1:真, 0:假")
        private String modelValidDb;

        @ApiModelProperty(value = "模型分析结果验证-视频问题真假 1:真, 0:假")
        private String modelValidVideo;

        @Length(max = 300, message = "备注说明长度大于300")
        @ApiModelProperty(value = "模型分析结果验证-备注说明")
        private String modelValidDetails;

        @NotBlank(message = "反馈人不可以为空")
        @Length(max = 20, message = "反馈人长度大于20")
        @ApiModelProperty(value = "模型分析结果验证-反馈人")
        private String modelValidPerson;
    }

    @Data
    public static class PollutantLimitVo {
        @ApiModelProperty("污染物上限")
        private String upperLimit;

        @ApiModelProperty("污染物下限")
        private String lowerLimit;
    }

    @Data
    public static class PollutantVo {
        @ApiModelProperty("取值属性名")
        private String prop;

        @ApiModelProperty("污染物上下限map，key为时间")
        private Map<String, PollutantLimitVo> pollutantLimitMap;

        @ApiModelProperty("标记线")
        private EChartsVO.MarkLine markLine;

        @ApiModelProperty("标记区域")
        private EChartsVO.MarkArea markArea;

        @ApiModelProperty("是否问题参数")
        private Boolean problemParam;
    }

    @Data
    @ApiModel("生产工况监测大屏-治理设施异常问题统计vo")
    public static class CountVo {
        @ApiModelProperty(value = "名称")
        private String name;

        @ApiModelProperty(value = "问题数量")
        private Long count;
    }

}
