package com.dayou.service.workflow;
import com.dayou.dto.WorkNodeDTO;
import com.dayou.entity.WorkNode;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dayou.enums.MainBusinessEnum;
import com.dayou.enums.ProductionEnum;
import com.dayou.enums.workflow.WorkflowNodeEnum;
import com.dayou.vo.NameCodeVO;

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

/**
 * <p>
 * 工作流节点 服务类
 * </p>
 *
 * @author wucl
 * @since 2023-10-17
 */
public interface IWorkNodeService extends IService<WorkNode> {

        Page<WorkNode> selectPage(Page page,WorkNode workNode);

        WorkNode detail(Long id);

        Boolean add(WorkNodeDTO workNode);

        Boolean update(WorkNodeDTO workNode);

        Boolean delete(Long id);

    /**
     * 获取所有已配置节点
     * @return
     */
    List<NameCodeVO> allNode();

    /**
     * 获取固定工作流节点，严格排序
     * @param flowId
     * @return
     */
    List<WorkNodeDTO> getFlowNodes(Long flowId ,String businessType);

    List<WorkNodeDTO> getFlowNodes(Long flowId);

    /**
     * 获取当前节点的下一个节点
     * @param flowId
     * @param nodeId
     * @return
     */
    WorkNodeDTO getNextWorkNode(Long flowId,Long nodeId);

    /**
     * 当前节点需校验业务数据，若要忽略节点，获取忽略后的第一个节点。
     * @param flowId
     * @param necessaryNodes
     * @param mainBusinessEnum
     * @return
     */
    WorkNodeDTO getNextWorkNodeByBusiness(Long flowId, MainBusinessEnum mainBusinessEnum, String nodeCode, Map<String,List<WorkflowNodeEnum>> necessaryNodes,Boolean ifPay);

    /**
     * 获取下单节点
     * @param flowId
     * @return
     */
    WorkNodeDTO getOpeningOrderNode(Long flowId);

    /**
     * 根据业务评估价格 判断是否跳过复审，三审节点
     * @param flowId
     * @param nodeCode
     * @param doSecondCheck
     * @param doThirdCheck
     * @return
     */
    WorkNodeDTO getNextWorkNodeByCheckState(Long flowId, String nodeCode,String doSecondCheck,String doThirdCheck);

    /**
     * 资产节点跳过判断方法
     * @param flowId 流程id
     * @param nodeCode 节点code
     * @return WorkNodeDTO
     */
    WorkNodeDTO getNextWorkNodeByFourthCheckState(Long flowId, String nodeCode);

    List<WorkNode> getNodesByMainBusiness(String businessType);

    void removeNodeCache(Long flowId);

    WorkNodeDTO getUniqueNodeByFlowNameAndNodeName(MainBusinessEnum personalBusiness, WorkflowNodeEnum determinePrice);

    //修改产品退回到撰写节点
    WorkNodeDTO changeProductionRetNextNode(String nodeCode, List<ProductionEnum> production,Long businessId);

    WorkNodeDTO doCreatedDepartmentAllocationNode();
}
