package com.erp.finance.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.erp.finance.dto.*;
import com.erp.finance.entity.IncomeRecord;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.erp.common.core.model.ApiResponse;

/**
 * 收款记录服务接口
 */
public interface IncomeService {

    /**
     * 记录收款（订单完成时调用）
     */
    IncomeRecord recordIncome(FinanceApiResponse.IncomeRecordRequest request);

    /**
     * 确认收款
     */
    IncomeRecord confirmIncome(Long id, String operator);

    /**
     * 取消收款
     */
    void cancelIncome(Long id, String reason, String operator);

    /**
     * 查询收款记录
     */
    IPage<IncomeRecord> query(IncomeQueryRequest request);

    /**
     * 根据ID查询
     */
    IncomeRecord getById(Long id);

    /**
     * 根据收款单号查询
     */
    IncomeRecord getByIncomeNo(String incomeNo);

    /**
     * 根据订单号查询收款记录
     */
    IncomeRecord getByOrderNo(String orderNo);

    /**
     * 统计某时间段内的收款总额
     */
    BigDecimal sumConfirmedAmount(LocalDateTime startTime, LocalDateTime endTime);

    /**
     * 获取日/周/月收款统计
     */
    FinanceReportResponse getIncomeStatistics(LocalDateTime startTime, LocalDateTime endTime);
}
