package com.njcn.gather.result.pojo.vo;

import com.njcn.gather.pojo.constant.DetectionValidMessage;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * @author caozehui
 * @data 2025-09-10
 */
@Data
public class MonitorResultVO implements Comparable<MonitorResultVO> {

    @ApiModelProperty(value = "监测点id", required = true)
    @NotBlank(message = DetectionValidMessage.DEV_MONITOR_ID_NOT_BLANK)
    private String monitorId;

    @ApiModelProperty(value = "监测点序号")
    private Integer monitorNum;

    @ApiModelProperty(value = "总检测次数")
    private Integer totalNum;

    @ApiModelProperty(value = "合格检测次数")
    private Integer qualifiedNum;

    @ApiModelProperty(value = "不合格检测次数")
    private Integer unQualifiedNum;

    @ApiModelProperty(value = "误差体系名称")
    private String errorSysName;

    @ApiModelProperty(value = "检测结果", required = true)
    @NotNull(message = DetectionValidMessage.DEV_MONITOR_RESULT_NOT_NULL)
    private Integer checkResult;


    @ApiModelProperty(value = "结论来源")
    private String resultOrigin;

    @ApiModelProperty(value = "使用哪次检测结果", required = true)
    @NotNull(message = DetectionValidMessage.DEV_MONITOR_RESULT_NUM_NOT_BLANK)
    private String whichTime;


    @ApiModelProperty(value = "数据源类型", required = true)
    @NotBlank(message = DetectionValidMessage.DEV_MONITOR_RESULT_TYPE_NOT_BLANK)
    private String resultType;

    /**
     * 根据线路号排序
     */
    @Override
    public int compareTo(MonitorResultVO other) {
        if (this.monitorNum == null && other.monitorNum == null) {
            return 0;
        }
        if (this.monitorNum == null) {
            return 1;
        }
        if (other.monitorNum == null) {
            return -1;
        }
        return this.monitorNum.compareTo(other.monitorNum);
    }
}
