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

import com.utic.center.common.annotation.SqlOperation;
import com.utic.center.utic.ptis.server.dao.mapper.UticPtisServerMapper;
import com.utic.center.utic.ptis.server.dto.IndigoStatsDataDto;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@RequiredArgsConstructor
public class UticPtisServerRepository {

    private final UticPtisServerMapper mapper;

    @SqlOperation(type = SqlOperation.SqlType.SELECT, table = "CURLINKST_POLICE_LOG")
    public String findLastRegDateCurrLinkSt() {
        return this.mapper.findLastRegDateCurrLinkSt();
    }
    @SqlOperation(type = SqlOperation.SqlType.SELECT, table = "EVENTID_POLICE_LOG")
    public String findLastRegDateEventId() {
        return this.mapper.findLastRegDateEventId();
    }
    @SqlOperation(type = SqlOperation.SqlType.SELECT, table = "OCCURID_POLICE_LOG")
    public String findLastRegDateOccurId() {
        return this.mapper.findLastRegDateOccurId();
    }

    @SqlOperation(type = SqlOperation.SqlType.SELECT, table = "INDIGO_STATS")
    public List<IndigoStatsDataDto> findAllIndigoStats() {
        return this.mapper.findAllIndigoStats();
    }

    @SqlOperation(type = SqlOperation.SqlType.INSERT, table = "INDIGO_STATS", param = "info", param2 = "countSnd")
    public int insertIndigoStats(String ifId, String agency, String info, String period, String countSnd) {
        return this.mapper.insertIndigoStats(ifId, agency, info, period, countSnd);
    }

    @SqlOperation(type = SqlOperation.SqlType.MERGE, table = "INDIGO_STATS", param = "info", param2 = "countSnd")
    public int mergeIndigoStats(String ifId, String agency, String info, String period, String countSnd) {
        return this.mapper.mergeIndigoStats(ifId, agency, info, period, countSnd);
    }

    @SqlOperation(type = SqlOperation.SqlType.SELECT, table = "SYSDATE_DUAL")
    public String findOneSysNow() {
        return this.mapper.findOneSysNow();
    }
    @SqlOperation(type = SqlOperation.SqlType.INSERT, table = "CURLINKST_POLICE_LOG")
    public int insertCurlinkstPoliceLog() {
        return this.mapper.insertCurlinkstPoliceLog();
    }
    @SqlOperation(type = SqlOperation.SqlType.TRUNCATE, table = "RCV_LINK_TRAFFIC_TMP")
    public int deleteRcvLinkTrafficTmp() {
        return this.mapper.deleteRcvLinkTrafficTmp();  // none return value
    }
    @SqlOperation(type = SqlOperation.SqlType.INSERT, table = "RCV_LINK_TRAFFIC_TMP")
    public int insertRcvLinkTrafficTmp() {
        return this.mapper.insertRcvLinkTrafficTmp();
    }

    @SqlOperation(type = SqlOperation.SqlType.DELETE, table = "RCV_LINK_TRAFFIC")
    public int deleteRcvLinkTraffic() {
        return this.mapper.deleteRcvLinkTraffic();
    }

    @SqlOperation(type = SqlOperation.SqlType.SELECT, table = "UTISINCI.TB_IMS_DATA@UTISDB", param = "INCIDENT_TYPE_CD <> '1'")
    public String findOneMaxEventRegDate() {
        return this.mapper.findOneMaxEventRegDate();
    }
    @SqlOperation(type = SqlOperation.SqlType.INSERT, table = "EVENTID_POLICE_LOG")
    public int insertEventidPoliceLog(String fromDate, String toDate) {
        return this.mapper.insertEventidPoliceLog(fromDate, toDate);
    }
    @SqlOperation(type = SqlOperation.SqlType.INSERT, table = "EVENTID_POLICE_LOG_TMP")
    public int insertEventidPoliceLogTmp(String fromDate, String toDate) {
        return this.mapper.insertEventidPoliceLogTmp(fromDate, toDate);
    }

    @SqlOperation(type = SqlOperation.SqlType.SELECT, table = "UTISINCI.TB_IMS_DATA@UTISDB", param = "INCIDENT_TYPE_CD = '1'")
    public String findOneMaxIncdRegDate() {
        return this.mapper.findOneMaxIncdRegDate();
    }
    @SqlOperation(type = SqlOperation.SqlType.INSERT, table = "OCCURID_POLICE_LOG")
    public int insertOccuridPoliceLog(String fromDate, String toDate) {
        return this.mapper.insertOccuridPoliceLog(fromDate, toDate);
    }
    @SqlOperation(type = SqlOperation.SqlType.INSERT, table = "OCCURID_POLICE_LOG_TMP")
    public int insertOccuridPoliceLogTmp(String fromDate, String toDate) {
        return this.mapper.insertOccuridPoliceLogTmp(fromDate, toDate);
    }

    @SqlOperation(type = SqlOperation.SqlType.DELETE, table = "EVENTID_POLICE_LOG")
    public int deleteEventidPoliceLog() {
        return this.mapper.deleteEventidPoliceLog();
    }
    @SqlOperation(type = SqlOperation.SqlType.DELETE, table = "EVENTID_POLICE_LOG_TMP")
    public int deleteEventidPoliceLogTmp() {
        return this.mapper.deleteEventidPoliceLogTmp();
    }
    @SqlOperation(type = SqlOperation.SqlType.DELETE, table = "OCCURID_POLICE_LOG")
    public int deleteOccuridPoliceLog() {
        return this.mapper.deleteOccuridPoliceLog();
    }
    @SqlOperation(type = SqlOperation.SqlType.DELETE, table = "OCCURID_POLICE_LOG_TMP")
    public int deleteOccuridPoliceLogTmp() {
        return this.mapper.deleteOccuridPoliceLogTmp();
    }

}
