package incheon.ags.dtm.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;

import incheon.ags.dtm.vo.DmapDownloadVO;
import incheon.ags.dtm.vo.DtmAddressVO;
import incheon.ags.dtm.vo.DtmApplyItemVO;
import incheon.ags.dtm.vo.DtmApplyListVO;
import incheon.ags.dtm.vo.DtmApplySearchVO;
import incheon.ags.dtm.vo.DtmApplyVO;
import incheon.ags.dtm.vo.DtmApproveVO;
import incheon.ags.dtm.vo.DtmComboVO;
import incheon.ags.dtm.vo.DtmDmapDtVO;
import incheon.ags.dtm.vo.DtmDmapHistDtVO;
import incheon.cmm.g2f.layer.vo.TaskLayerSearchRequestDTO;
import incheon.cmm.g2f.layer.vo.TaskLayerVO;
import incheon.com.config.annotation.MainDB;

@Mapper @MainDB
public interface DtmMapper {

    List<TaskLayerVO> getLayerList(TaskLayerSearchRequestDTO searchVO);
    
    List<DtmDmapDtVO> selectDmapDtList(DtmDmapDtVO dtmDmapDtVO) throws Exception;
    List<DtmDmapDtVO> selectDmapDtListBySig(DtmDmapDtVO dtmDmapDtVO) throws Exception;
    List<DtmDmapDtVO> selectDmapDtListByEmd(DtmDmapDtVO dtmDmapDtVO) throws Exception;
    Long getContentIdSeq() throws Exception;
    List<DtmDmapHistDtVO> searchDmapDtDetail(DtmDmapDtVO dtmDmapDtVO) throws Exception;
    List<DtmDmapDtVO> selectApplyDmapDtList(DtmDmapDtVO dtmDmapDtVO) throws Exception;
    /* 사업명 */
    List<DtmComboVO> selectBizList();

    List<DtmAddressVO> selectAddrCodeByPoint(DtmAddressVO filterVO);
    
    /* ===============================
     * 수치지형도 신청 Mapper (추가)
     * =============================== */

    Long selectNextAplySn();

    void insertApplyMaster(DtmApplyVO vo);

    void insertApplyItem(DtmApplyItemVO vo);
    
    List<DtmApplyListVO> selectApplyList(DtmApplySearchVO vo);
    
    List<DtmApplyListVO> selectApplyAdminList(DtmApplySearchVO vo);
    
    
    /* ===============================
     * 관리자 인수증 업로드 Mapper (추가)
     * =============================== */
    int checkCertExists(@Param("aplySn") String aplySn);

    int insertCertFile(
        @Param("aplySn") String aplySn,
        @Param("flpth") String flpth
    );

    int updateCertFile(
        @Param("aplySn") String aplySn,
        @Param("flpth") String flpth
    );
    
    
    /* ===============================
     * 관리자 승인 Mapper (추가)
     * =============================== */
    String selectRlsYn(String aplySn);

    List<String> selectMapFiles(String aplySn);

    int updateApprove(@Param("userId") String userId,
                      @Param("zipPath") String zipPath,
                      @Param("aplySn") String aplySn);

    int insertDigitRegister(String aplySn);
    
    
    /* ===============================
     * 관리자 취소/반려 Mapper (추가)
     * =============================== */
    int applyCancel(DtmApproveVO vo);
    
    
    /* ===============================
     * 관리자 수치지형도 다운로드 Mapper (추가)
     * =============================== */
    DmapDownloadVO selectDownloadInfo(long aplySn);
     
}

