package com.utic.center.utic.ptis.server.repository;

import com.utic.center.common.dto.ProcessStateDto;
import com.utic.center.common.utils.TimeUtils;
import com.utic.center.utic.ptis.server.dto.BatchJobInfoDto;
import com.utic.center.utic.ptis.server.dto.IndigoStatsDto;
import com.utic.center.utic.ptis.server.dto.RegDateDto;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.List;

@Slf4j
@Getter
public class ApplicationRepository {

    private ApplicationRepository() {
        throw new IllegalStateException("ApplicationRepository class");
    }
    public static final ProcessStateDto processState = ProcessStateDto.builder()
            .processId("70030")
            .regDate("")
            .runState(ProcessStateDto.RUN_STATE.NORMAL.getValue())
            .rcvCnt(0)
            .sndCnt(0)
            .etcCnt(0)
            .errDesc("")
            .errTimeGap(120)
            .build();

    public static final RegDateDto lastRegDate = RegDateDto.builder()
            .trafDt(TimeUtils.getCurrentTimeString())
            .evntDt(TimeUtils.getCurrentTimeString())
            .incdDt(TimeUtils.getCurrentTimeString())
            .build();

    public static final IndigoStatsDto indigoStats = IndigoStatsDto.builder()
            .trafCnt(0)
            .evntCnt(0)
            .incdCnt(0)
            .build();

    public static List<BatchJobInfoDto> batchJobInfoList = new ArrayList<>();

    public static void addJobInfo(BatchJobInfoDto jobInfo) {
        if (batchJobInfoList.size() > 72) {
            batchJobInfoList.remove(0);
        }
        batchJobInfoList.add(jobInfo);
    }

}
