package com.jwipc.finance.logic;

import com.jwipc.finance.dto.*;
import com.jwipc.finance.entity.InvoicedApply;
import com.jwipc.finance.entity.InvoicedApplyPa;
import com.jwipc.finance.model.query.PaymentApplyItemQuery;
import com.jwipc.page.PageView;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 *
 * </p>
 *
 * @author wt
 * @version 1.0
 * @since 2024/3/8
 */
public interface PaymentAdvanceApplyDetailLogic {
    /**
     * 根据预付款申请单ID获取明细信息
     *
     * @param applyId      预付款申请单ID
     * @param dataShowType 数据展示类型 1:编辑 2:查看
     * @return 结果
     */
    PageView findPaaDetailByPaaId(Long applyId, Integer dataShowType, Integer optType);
    List<CreatePaaDetailDto> findPaaDetailListByPaaIdAndType(Long applyId,Integer dataShowType);
    List<CreatePaaDetailDto> findPaaDetailListByPaaId(Long applyId);

    /**
     * 根据id获取该单据下的订单付款记录信息
     * @param applyId 单据id
     * @param type advance_payment 预付款 cash_on_delivery 货到付款
     * @param poCodeListFromParams  订单信息
     * @return
     */
    PageView findPaymentDetail(Long applyId, String type, List<String> accountStatementNoListFromParams);

    /**
     * 根据采购订单号查询该订单的详细的付款明细
     * @param poCode
     * @return
     */
    List<PaymentRecordDTO> findDetailByPoCode(String poCode);

    /**
     *根据采购订单号获取预付款的采购订单数据
     * @param query
     * @return
     */
    List<CreatePaaDetailDto> findAdvanceApplyDataByPoCode(PaymentApplyItemQuery query);

    List<CreatePcaDetailDto> findAdvanceApplyDataByDataKey(List<String> dataKeys);

    /**
     * 开票申请获取预付款信息
     *
     * @param query 查询条件
     * @return 结果
     */
    List<InvoicedApplyPaDTO> provideCreateAdvanceApply(PaymentApplyItemQuery query);

    void updatePaymentAdvanceDetailDateType(String appNo, String itemNo,Integer dataType);

    void updateReversedAmount(String paymentChangeNumber, String paymentChangeItemNo, BigDecimal strikePrice);

    void hasUnappliedPrepaymentBalance(InvoicedApplyDTO headDto, List<InvoicedApplyPa> addAdvances);
}
