package incheon.ags.ias.sysMenuAuthrt.mapper;

import incheon.ags.ias.sysMenuAuthrt.vo.AuthrtStngVO;
import incheon.ags.ias.sysMenuAuthrt.vo.MenuRoleAuthrtMpngVO;
import incheon.ags.ias.sysMenuAuthrt.vo.SysMenuAuthrtSearchVO;
import incheon.ags.ias.sysMenuAuthrt.vo.SysRoleAuthrtMpngVO;
import incheon.com.config.annotation.MainDB;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;

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

@org.egovframe.rte.psl.dataaccess.mapper.Mapper @incheon.com.config.annotation.MainDB
public interface SysMenuAuthrtMapper {

    // 메뉴 권한 목록 조회
    List<Map<String, Object>> selectSysMenuAuthrtList(SysMenuAuthrtSearchVO sysMenuAuthrtSearchVO) throws Exception;

    // 메뉴 권한 목록 카운트 조회
    int selectSysMenuAuthrtListCnt(SysMenuAuthrtSearchVO sysMenuAuthrtSearchVO) throws Exception;

    // 권한 목록 조회
    List<Map<String, Object>> selectAuthrtList() throws Exception;

    // 역할 목록 조회
    List<Map<String, Object>> selectRoleList() throws Exception;

    // 권한 설정 조회 (MENU 타입) - sysCd 필터링
    List<Map<String, Object>> selectAuthrtStngList(String sysCd) throws Exception;

    // 권한 설정 조회 (특정 타입과 타겟)
    List<Map<String, Object>> selectAuthrtStngByTarget(Map<String, Object> params) throws Exception;

    // 시스템 전역 권한 조회 (SYS 타입) - sysCd 필터링
    List<Map<String, Object>> selectSystemAuthrtList(String sysCd) throws Exception;

    // 특정 역할 정보 조회 (ROLE_CD + SYS_CD 복합키)
    Map<String, Object> selectRoleInfo(Map<String, Object> params) throws Exception;

    // SYS_CD로 메뉴 목록 조회 (계층 구조)
    List<Map<String, Object>> selectMenuListBySysCd(String sysCd) throws Exception;

    // 시스템 목록 조회
    List<Map<String, Object>> selectSystemList() throws Exception;


    // 메뉴-역할-권한 매핑 등록
    int insertMenuRoleAuthrtMpng(MenuRoleAuthrtMpngVO menuRoleAuthrtMpngVO) throws Exception;

    // 메뉴-역할-권한 매핑 삭제 (역할별 전체 또는 시스템별)
    int deleteMenuRoleAuthrtMpngByRoleCd(Map<String, Object> params) throws Exception;

    // 시스템-역할-권한 매핑 등록
    int insertSysRoleAuthrtMpng(SysRoleAuthrtMpngVO sysRoleAuthrtMpngVO) throws Exception;

    // 시스템-역할-권한 매핑 삭제 (역할별 전체 또는 시스템별)
    int deleteSysRoleAuthrtMpngByRoleCd(Map<String, Object> params) throws Exception;

    // 특정 역할의 메뉴-권한 매핑 전체 조회
    List<Map<String, Object>> selectSysMenuAuthrtByRoleCd(Map<String, Object> params) throws Exception;

    // 특정 역할의 시스템-권한 매핑 전체 조회
    List<Map<String, Object>> selectSysRoleAuthrtByRoleCd(Map<String, Object> params) throws Exception;

    // 권한 설정 등록
    int insertAuthrtStng(AuthrtStngVO authrtStngVO) throws Exception;

    // 권한 설정 삭제 (특정 타입과 타겟)
    int deleteAuthrtStngByTarget(Map<String, Object> params) throws Exception;

    // 메뉴-역할-권한 매핑 삭제 (특정 메뉴의 특정 권한 전체)
    int deleteMenuRoleAuthrtMpngByMenuAndAuthrt(Map<String, Object> params) throws Exception;

    // 시스템-역할-권한 매핑 삭제 (특정 시스템의 특정 권한 전체)
    int deleteSysRoleAuthrtMpngBySysAndAuthrt(Map<String, Object> params) throws Exception;
}
