package com.yd.csf.service.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yd.common.result.Result;
import com.yd.csf.feign.response.policyfollow.ApiPolicyFollowDetailResponse;
import com.yd.csf.service.dto.*;
import com.yd.csf.service.enums.PolicyFollowStatusEnum;
import com.yd.csf.service.model.*;
import com.yd.csf.service.vo.PolicyFollowDetailVO;
import com.yd.csf.service.vo.PolicyFollowVO;
import com.yd.csf.service.vo.PolicyNumberResponseVO;

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

/**
* @author Zhang Jianan
* @description 针对表【policy_follow(新单跟进表)】的数据库操作Service
* @createDate 2025-09-16 18:18:06
*/
public interface PolicyFollowService extends IService<PolicyFollow> {

    PolicyFollow getByPolicyBizId(String policyBizId);

    QueryWrapper<PolicyFollow> getQueryWrapper(PolicyFollowQueryRequest policyFollowQueryRequest);

    Page<PolicyFollowVO> getPolicyFollowVOPage(Page<PolicyFollow> policyFollowPage);

    Boolean updatePolicyFollow(PolicyFollowUpdateRequest policyFollowUpdateRequest);

    /**
     * 使用统一DTO更新新单跟进
     */
    Boolean updatePolicyFollowDto(PolicyFollowDto policyFollowDto);

    PolicyFollowVO getPolicyFollowVO(PolicyFollow policyFollow);

    Map<String, Object> addPolicyFollow(PolicyFollowAddRequest policyFollowAddRequest);

    /**
     * 使用统一DTO新增新单跟进
     */
    Map<String, Object> addPolicyFollowDto(PolicyFollowDto policyFollowDto);

    /**
     * 获取新单跟进详情（包含附加险和介绍人）
     */
    PolicyFollowDetailVO getPolicyFollowDetailVO(String policyBizId);

    Boolean addToPolicy(List<String> policyNoList);

    Boolean changePolicyFollowStatus(ChangePolicyFollowStatusRequest changePolicyFollowStatusRequest, PolicyFollow policyFollow);

    Boolean uploadAttachment(AttachmentUploadRequest attachmentUploadRequest);

    String queryReconciliationCompanyByFeign(String reconciliationCompanyBizId);

    String getNextStatus(PolicyFollowStatusEnum policyFollowStatusEnum);

    String getCurrencyValue(String currency);

    PolicyReportData queryPolicyReportData(String policyBizId);

    PolicyFollow queryOneByPolicyNo(String policyNo);

    PolicyFollow queryOneByPolicyBizId(String policyBizId);

    /**
     * 保存首期缴费信息
     */
    Boolean saveInitialPayment(InitialPaymentSaveRequest initialPaymentSaveRequest);

    /**
     * 保存邮寄信息
     */
    Boolean saveMailingInfo(MailingInfoSaveRequest mailingInfoSaveRequest);

    /**
     * 批量保存介绍人信息
     */
    Boolean batchSaveBrokers(BrokerBatchSaveRequest brokerBatchSaveRequest);

    /**
     * 查询保单号列表
     *
     * @param policyNosQueryRequest 保单号查询请求
     * @return 保单号列表
     */
    Page<PolicyNumberResponseVO> queryPolicyNumbers(PolicyNosQueryRequest policyNosQueryRequest);

    List<PolicyFollow> queryList(List<String> policyNoList);

    List<PolicyFollow> queryListByAppointmentBizId(String appointmentBizId);

    /**
     * 查询产品计划信息
     *
     * @param policyBizId 新单跟进业务ID
     * @return 产品计划信息
     */
    PolicyDto getProductPlan(String policyBizId);

    /**
     * 查询投保人信息
     *
     * @param policyBizId 新单跟进业务ID
     * @return 投保人信息
     */
    PolicyPolicyholder getPolicyPolicyholder(String policyBizId);

    /**
     * 查询受保人信息
     *
     * @param policyBizId 新单跟进业务ID
     * @return 受保人信息
     */
    PolicyInsurant getPolicyInsurant(String policyBizId);

    /**
     * 查询受益人列表
     *
     * @param policyBizId 新单跟进业务ID
     * @return 受益人列表
     */
    List<PolicyBeneficiary> getPolicyBeneficiaryList(String policyBizId);

    /**
     * 查询第二持有人信息
     *
     * @param policyBizId 新单跟进业务ID
     * @return 第二持有人信息
     */
    PolicySecondHolder getPolicySecondHolder(String policyBizId);

    /**
     * 查询预约附件列表
     *
     * @param policyBizId 新单跟进业务ID
     * @return 预约附件列表
     */
    List<PolicyAppointmentFile> getPolicyAppointmentFileList(String policyBizId);

    /**
     * 更新产品计划信息
     *
     * @param policyUpdateRequest 产品计划更新请求
     * @return 是否成功
     */
    Boolean updateProductPlan(PolicyUpdateRequest policyUpdateRequest);

    /**
     * 更新投保人信息
     *
     * @param policyPolicyholderUpdateRequest 投保人更新请求
     * @return 是否成功
     */
    Boolean updatePolicyPolicyholder(PolicyPolicyholderUpdateRequest policyPolicyholderUpdateRequest);

    /**
     * 更新受保人信息
     *
     * @param policyInsurantUpdateRequest 受保人更新请求
     * @return 是否成功
     */
    Boolean updatePolicyInsurant(PolicyInsurantUpdateRequest policyInsurantUpdateRequest);

    /**
     * 更新受益人列表
     *
     * @param policyBeneficiaryListUpdateRequest 受益人列表更新请求
     * @return 是否成功
     */
    Boolean updatePolicyBeneficiaryList(PolicyBeneficiaryListUpdateRequest policyBeneficiaryListUpdateRequest);

    /**
     * 更新第二持有人信息
     *
     * @param policySecondHolderUpdateRequest 第二持有人更新请求
     * @return 是否成功
     */
    Boolean updatePolicySecondHolder(PolicySecondHolderUpdateRequest policySecondHolderUpdateRequest);

    Result<ApiPolicyFollowDetailResponse> detail(String policyNo);

    List<String> queryPolicyNoList(String policyHolder,String signer,String brokerName,String insured);

    Result updateTs();
}
