package com.ruoyi.credit.service;

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

import com.ruoyi.credit.domain.LoanConsistencyValidation;

/**
 * 异步验证服务接口
 * 添加异步验证模式支持
 * 
 * @author ruoyi
 * @date 2025-12-31
 */
public interface AsyncValidationService {

    /**
     * 异步验证单个贷款
     * 
     * @param loanId 贷款ID
     * @param priority 验证优先级
     * @return 异步验证结果
     */
    CompletableFuture<LoanConsistencyValidation> validateLoanAsync(Long loanId, String priority);

    /**
     * 异步批量验证贷款
     * 
     * @param loanIds 贷款ID列表
     * @param batchSize 批次大小
     * @return 异步批量验证结果
     */
    CompletableFuture<List<LoanConsistencyValidation>> batchValidateLoansAsync(List<Long> loanIds, int batchSize);

    /**
     * 异步重新验证贷款
     * 
     * @param loanId 贷款ID
     * @param reason 重新验证原因
     * @return 异步重新验证结果
     */
    CompletableFuture<LoanConsistencyValidation> revalidateLoanAsync(Long loanId, String reason);

    /**
     * 获取异步验证任务状态
     * 
     * @param taskId 任务ID
     * @return 任务状态信息
     */
    Map<String, Object> getAsyncValidationTaskStatus(String taskId);

    /**
     * 取消异步验证任务
     * 
     * @param taskId 任务ID
     * @return 是否取消成功
     */
    boolean cancelAsyncValidationTask(String taskId);

    /**
     * 获取异步验证服务状态
     * 
     * @return 服务状态信息
     */
    Map<String, Object> getAsyncValidationServiceStatus();
}