package com.erp.approval.service;

import com.erp.approval.dto.AuditLogQueryRequest;
import com.erp.common.core.model.PageResponse;
import com.erp.approval.entity.AuditLog;

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

/**
 * 审核日志服务接口
 */
public interface AuditLogService {
    
    /**
     * 分页查询日志
     */
    PageResponse<AuditLog> listLogs(Long tenantId, AuditLogQueryRequest request);
    
    /**
     * 获取日志详情
     */
    Optional<AuditLog> getLogById(Long tenantId, Long id);
    
    /**
     * 获取日志统计
     */
    Map<String, Map<String, Long>> getStats(Long tenantId, String startDate, String endDate);
    
    /**
     * 记录日志
     */
    AuditLog log(String module, String action, String targetType, Long targetId, 
                 Map<String, Object> oldValues, Map<String, Object> newValues);
    
    /**
     * 记录创建操作
     */
    AuditLog logCreate(String module, String targetType, Long targetId, Map<String, Object> newValues);
    
    /**
     * 记录更新操作
     */
    AuditLog logUpdate(String module, String targetType, Long targetId, Map<String, Object> oldValues, Map<String, Object> newValues);
    
    /**
     * 记录删除操作
     */
    AuditLog logDelete(String module, String targetType, Long targetId, Map<String, Object> oldValues);
    
    /**
     * 记录审核通过
     */
    AuditLog logApprove(String module, Long targetId, Map<String, Object> oldValues, Map<String, Object> newValues);
    
    /**
     * 记录审核驳回
     */
    AuditLog logReject(String module, Long targetId, Map<String, Object> oldValues, Map<String, Object> newValues, String reason);
}
