package cn.novalon.gym.manage.sys.audit.repository;

import cn.novalon.gym.manage.sys.audit.domain.AuditLog;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.time.LocalDateTime;

/**
 * 审计日志仓储接口
 * 
 * @author 张翔
 * @date 2026-04-01
 */
public interface IAuditLogRepository {

    Mono<AuditLog> findById(Long id);

    Mono<AuditLog> save(AuditLog auditLog);

    Mono<Void> deleteById(Long id);

    Flux<AuditLog> findAll();

    Flux<AuditLog> findByEntityType(String entityType);

    Flux<AuditLog> findByEntityId(Long entityId);

    Flux<AuditLog> findByEntityTypeAndEntityId(String entityType, Long entityId);

    Flux<AuditLog> findByOperator(String operator);

    Flux<AuditLog> findByOperationType(String operationType);

    Flux<AuditLog> findByOperationTimeBetween(LocalDateTime startTime, LocalDateTime endTime);

    Flux<AuditLog> findByEntityTypeAndOperationTimeBetween(
        String entityType, 
        LocalDateTime startTime, 
        LocalDateTime endTime
    );

    Flux<AuditLog> findByOperatorAndOperationTimeBetween(
        String operator, 
        LocalDateTime startTime, 
        LocalDateTime endTime
    );

    Mono<Long> countByEntityType(String entityType);

    Mono<Long> countByOperationType(String operationType);

    Mono<Long> countByOperator(String operator);

    Mono<Long> countByOperationTimeBetween(LocalDateTime startTime, LocalDateTime endTime);
}
