package com.zioinfo.hrm.admin;

import com.zioinfo.hrm.auth.HrmUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

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

@Mapper
public interface AdminMapper {
    List<HrmUser> findAllUsers();
    HrmUser findUserById(@Param("id") Long id);
    int insertUser(HrmUser user);
    int updateUser(HrmUser user);
    int updateUserActive(@Param("id") Long id, @Param("active") boolean active);
    /** 관리자 OTP 초기화: 시크릿 폐기 + otp_enabled=false(다음 로그인 시 재등록 유도). 시크릿 미노출. */
    int clearOtp(@Param("id") Long id);
    List<Map<String, Object>> findAuditLogs(@Param("actor") String actor,
                                             @Param("action") String action,
                                             @Param("offset") int offset,
                                             @Param("limit") int limit);
    long countAuditLogs(@Param("actor") String actor, @Param("action") String action);
    int insertAuditLog(Map<String, Object> log);
    List<Map<String, Object>> findSettings();
    Map<String, Object> findSetting(@Param("key") String key);
    int upsertSetting(Map<String, Object> setting);
}
