package com.eactive.eai.rms.onl.dashboard.modern.backup;

import com.eactive.eai.rms.onl.dashboard.modern.service.ThroughputCalculationService;
import com.eactive.eai.rms.onl.tracking.vo.DbStaticsVo;
import com.eactive.eai.rms.onl.tracking.vo.MemStaticsVo;
import com.eactive.eai.rms.onl.vo.MonitorDataVo;
import com.eactive.eai.rms.onl.vo.SmsVO;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@Getter
@Setter
public class BackupContentVO implements Serializable {

    private String backupTimestamp;
    private RepositoryFields repositoryFields;
    private DashboardRepository2Fields dashboardRepository2Fields;
//    private ThroughputFields throughputFields; 백업 필요 없는 저장소

    public BackupContentVO() {
        this.backupTimestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
    }

    @Getter
    @Setter
    @NoArgsConstructor
    public static class RepositoryFields implements Serializable {
        private Map<String, MonitorDataVo> repository;
        private ConcurrentHashMap<String, MonitorDataVo> repositoryNoExpire;
    }

    @Getter
    @Setter
    @NoArgsConstructor
    public static class DashboardRepository2Fields implements Serializable {
        private Map<String, Map<String, String>> repoEAISevrDstcd;
        private Map<String, MemStaticsVo> repoMemTransaction;
        private Map<String, DbStaticsVo> repository;
        private Map<String, List<String>> repoHostNames;
        private Map<String, List<String>> repoInstNames;
        private Map<String, Map<String, List<String>>> repoDataSourceInstNames;
        private Map<String, String> repoHostAlive;
        private List<SmsVO> repoSms;
        private Map<String, String> repoPeakTps;
        private Map<String, String> repoPeakTrade;
        private int[] procBatch = new int[6];
        private int[] procEaiBatch = new int[6];
        private Map<String, Map<String, String>> itsmDashTranInfo;
        private Map<String, Map<String, String>> itsmDashPeakdayInfo;
        private Map<String, List> itsmDashDayTranList;
        private Map<String, List> itsmDashHourTranList;
        private Map<String, Map<String, String>> itsmDashBizErrorMap;
        private Map<String, Map<String, String>> itsmDashTimeoutErrorMap;
        private Map<String, Map<String, String>> itsmDashConnectErrorMap;
        private Map<String, Map<String, String>> itsmDashServerInstTotalProcMap;
    }

    @Getter
    @Setter
    @NoArgsConstructor
    public static class ThroughputFields {
        private Map<String, ThroughputCalculationService.TimeSeriesData> timeSeriesMap;
        private Map<String, ThroughputCalculationService.ServerResourceData> serverResourceMap;
        private Map<String, Map<String, Integer>> lastAccumulatedValuesMap;
    }

}



