package com.erp.approval.service;

import com.erp.approval.dto.OperationLogQueryRequest;
import com.erp.approval.entity.OperationLog;
import com.erp.common.core.model.PageResponse;
import jakarta.servlet.http.HttpServletResponse;

import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;

/**
 * 操作日志服务接口
 */
public interface OperationLogService {

    /**
     * 分页查询操作日志
     */
    PageResponse<OperationLog> listLogs(Long tenantId, OperationLogQueryRequest request);

    /**
     * 获取日志详情
     */
    OperationLog getLogById(Long tenantId, Long id);

    /**
     * 获取操作统计
     */
    Map<String, Object> getStatistics(Long tenantId, String startDate, String endDate);

    /**
     * 记录操作日志
     */
    OperationLog log(String module, String action, String method, String path,
                     Map<String, Object> requestParams, Integer responseCode, Integer executionTime, String remark);

    /**
     * 导出CSV
     */
    void exportCsv(Long tenantId, OperationLogQueryRequest request, HttpServletResponse response) throws Exception;

    /**
     * 导出Excel
     */
    void exportExcel(Long tenantId, OperationLogQueryRequest request, HttpServletResponse response) throws Exception;

    /**
     * 异步导出Excel（大数据量）
     */
    CompletableFuture<String> exportExcelAsync(Long tenantId, OperationLogQueryRequest request) throws Exception;

    /**
     * 查询导出数据
     */
    List<OperationLog> queryForExport(Long tenantId, OperationLogQueryRequest request);
}
