package incheon.ags.dss.status.mapper;

import java.util.Date;
import java.util.List;
import java.util.Map;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;

@Mapper
@incheon.com.config.annotation.MainDB
public interface AnaZoneStatMapper {

//	통계 년도 조회
	List<Map<String, Object>> selectAnalyzedYears(Map<String, Object> params) throws Exception;

//	적재된 통계 데이터 조회
	List<Map<String, Object>> selectBasicStats(Map<String, Object> params) throws Exception;

//	통계 지도 등록
	int insertAnaStatsMapMst(Map<String, Object> mstParams) throws Exception;
	void insertAnaStatsMapDtl(Map<String, Object> dtlParams) throws Exception;
	
	// Gap 분석 (심화 분석)
    List<Map<String, Object>> selectGapAnalysis(Map<String, Object> params) throws Exception;

	// Gap 분석 (심화 분석)
    List<Map<String, Object>> selectGapAnalysisAll(Map<String, Object> params) throws Exception;
    
	List<Map<String, Object>> selectWeightValYears() throws Exception;

	Map<String, Object> selectAnaStatsMapMstDetail(String hstryNo) throws Exception;

	// [JAVA 변환] 1. 기존 통계 데이터 삭제
	void deleteAnaZoneStatByTareNo(int tareNo) throws Exception;

	// [JAVA 변환] 2. 분석 가능한 연도 목록 조회 (ana_wghtval_sm 기준)
	List<String> selectAvailableAnalysisYears() throws Exception;

	// [JAVA 변환] 3. 특정 연도 통계 계산 및 저장 (INSERT ... SELECT)
	void insertCalculatedZoneStat(Map<String, Object> params) throws Exception;

	// 대상지 통계 데이터 건수 조회 (Polling용)
	int selectZoneStatCount(int tareNo) throws Exception;

	// [신규] 해당 구역의 마지막 분석 실행 일시 조회
	Date selectLastAnalysisDate(int tareNo) throws Exception;
}