package com.zioinfo.esn.admin.mapper;

import com.zioinfo.esn.admin.dto.AuditLog;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 감사 로그 매퍼. @Mapper 어노테이션 필수
 * (EsnApplication 의 @MapperScan(annotationClass = Mapper.class) 패턴).
 */
@Mapper
public interface AuditLogMapper {

    int insert(AuditLog log);

    List<AuditLog> find(@Param("tenantCode") String tenantCode,
                        @Param("username") String username,
                        @Param("action") String action,
                        @Param("resource") String resource,
                        @Param("from") LocalDateTime from,
                        @Param("to") LocalDateTime to,
                        @Param("limit") int limit);

    long count(@Param("tenantCode") String tenantCode,
               @Param("username") String username,
               @Param("action") String action,
               @Param("resource") String resource,
               @Param("from") LocalDateTime from,
               @Param("to") LocalDateTime to);
}
