package com.njcn.gather.systemmonitor.disk.pojo.vo;

import com.njcn.gather.systemmonitor.disk.pojo.dto.DiskMonitorNotifyHttpItem;
import com.njcn.gather.systemmonitor.disk.pojo.dto.DiskMonitorNotifyPathItem;
import lombok.Data;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * 磁盘监控接口返回对象。
 */
public class DiskMonitorVO {

    @Data
    public static class PolicyDetailVO {
        private PolicyVO policy;
        private List<TargetVO> targets = new ArrayList<>();
    }

    @Data
    public static class PolicyVO {
        private Long id;
        private String policyName;
        private Boolean monitorEnabled;
        private Boolean runOnAppStart;
        private String dailyRunTime;
        private String warningNotifyMode;
        private String alarmNotifyMode;
        private Long lastJobId;
        private String remark;
    }

    @Data
    public static class TargetVO {
        private Long id;
        private String driveLetter;
        private Boolean monitorEnabled;
        private Integer warningUsagePercent;
        private Integer alarmUsagePercent;
        private Boolean notifyPathEnabled;
        private List<DiskMonitorNotifyPathItem> notifyPathList = new ArrayList<>();
        private Boolean notifyHttpEnabled;
        private List<DiskMonitorNotifyHttpItem> notifyHttpList = new ArrayList<>();
        private String lastStatus;
        private String lastScanTime;
        private BigDecimal lastUsedPercent;
        private String remark;
    }

    @Data
    public static class JobRunVO {
        private Long jobId;
        private String jobNo;
    }

    @Data
    public static class JobListVO {
        private Long jobId;
        private String jobNo;
        private String jobSource;
        private String startedAt;
        private String finishedAt;
        private String jobStatus;
        private Integer targetCount;
        private Integer warningCount;
        private Integer alarmCount;
        private String message;
    }

    @Data
    public static class JobDetailVO {
        private JobInfoVO job;
        private List<ResultVO> results = new ArrayList<>();
        private List<NotifyLogVO> notifyLogs = new ArrayList<>();
    }

    @Data
    public static class JobInfoVO {
        private Long id;
        private String jobNo;
        private String jobSource;
        private String startedAt;
        private String finishedAt;
        private String jobStatus;
        private Integer targetCount;
        private Integer successCount;
        private Integer warningCount;
        private Integer alarmCount;
        private String message;
    }

    @Data
    public static class ResultVO {
        private Long resultId;
        private Long targetId;
        private String driveLetter;
        private Long totalBytes;
        private Long usedBytes;
        private Long freeBytes;
        private BigDecimal usedPercent;
        private String currentStatus;
        private String previousStatus;
        private Boolean statusChanged;
        private Boolean shouldNotify;
        private String notifyReason;
        private String scanTime;
        private String message;
    }

    @Data
    public static class NotifyLogVO {
        private Long id;
        private Long resultId;
        private String driveLetter;
        private String notifyLevel;
        private String channelType;
        private String channelTarget;
        private String sendStatus;
        private String responseMessage;
        private String sentAt;
    }
}
