package org.jeecg.modules.app.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.jeecg.modules.app.dto.SealInfoDTO;
import org.jeecg.modules.app.dto.SignCallbackDTO;
import org.jeecg.modules.app.esign.exception.EsignDemoException;
import org.jeecg.modules.system.app.dto.AppContractInfoDTO;
import org.jeecg.modules.system.app.dto.ContractSignDTO;
import org.jeecg.modules.system.app.entity.AppContractInfo;
import org.jeecg.modules.system.app.entity.AppContractSign;
import org.jeecg.modules.system.app.vo.ContractSignVO;

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

public interface IESignService {
    /**
     * @Author SheepHy
     * @Description 查询用户授权状态
     * @Date 9:42 2025/7/18
     * @Param phoneNumber
     * @return boolean
     **/
    boolean getUserIdentityInfo(String familyId) throws EsignDemoException;

    /**
     * @Author SheepHy
     * @Description 获取授权链接
     * @Date 9:42 2025/7/18
     * @Param
     * @return
     **/
    String getAuthUrl(String familyId) throws EsignDemoException;


    /**
     * @Author SheepHy
     * @Description 查询企业授权状态
     * @Date 13:33 2025/7/18
     * @Param
     * @return
     **/
    boolean getOrgIdentityInfos(String orgCode) throws EsignDemoException;

    /**
     * @Author SheepHy
     * @Description 企业获取授权链接
     * @Date 13:33 2025/7/18
     * @Param
     * @return
     **/
    String getOrgAuthUrls(String orgCode,String phoneNumber) throws EsignDemoException;

    /**
     * @Author SheepHy
     * @Description 上传合同底稿
     * @Date 9:54 2025/7/21
     * @Param
     * @return
     **/
    boolean uploadContractTemplate(AppContractInfoDTO appContractInfoDTO) throws Exception;


    /**
     * @Author SheepHy
     * @Description 发起签署
     * @Date 10:10 2025/7/21
     * @Param
     * @return
     **/
    String createSign(String orderCode, String familyId) throws EsignDemoException;

    /**
     * @Author SheepHy
     * @Description 获取签署链接
     * @Date 14:02 2025/7/21
     * @Param
     * @return
     **/
    String getSignUrl(String signFlowId) throws EsignDemoException;


    /**
     * @Author SheepHy
     * @Description 制作模板
     * @Date 14:47 2025/7/21
     * @Param
     * @return
     **/
    String createTemplate(String fileId) throws EsignDemoException;

    /**
     * @Author SheepHy
     * @Description 编辑合同
     * @Date 15:01 2025/7/21
     * @Param
     * @return
     **/
    String editContract(String docTemplateId) throws EsignDemoException;

    /**
     * @Author SheepHy
     * @Description 下载已签署文件及附属材料
     * @Date 14:05 2025/7/28
     * @Param
     * @return
     **/
    List<Map<String,String>> fileDownloadUrl(String signFlowId) throws EsignDemoException;

    /**
     * @Author SheepHy
     * @Description 合同列表查询
     * @Date 15:09 2025/7/28
     * @Param
     * @return
     **/
    List<AppContractInfo> queryContractInfo(String contractName);

    /**
     * @Author SheepHy
     * @Description 查询企业内部印章
     * @Date 11:46 2025/7/31
     * @Param
     * @return
     **/
    List<SealInfoDTO> orgOwnSeal(String orgCode);
    
    /** 
     * @Author SheepHy
     * @Description 跨企业印章授权
     * @Date 15:29 2025/7/31
     * @Param
     * @return 
     **/
    String orgSealsExternal(String orgCode, String sealId) throws EsignDemoException;

    /**
     * @Author SheepHy
     * @Description 获取合同预览页
     * @Date 13:36 2025/8/1
     * @Param
     * @return
     **/
    String templatePreviewUrl(String docTemplateId) throws EsignDemoException;

    /**
     * @Author SheepHy
     * @Description 签署回调处理
     * @Date 13:51 2025/8/6
     * @Param
     * @return
     **/
    Boolean signCallback(SignCallbackDTO jsonObject);

    /**
     * @Author SheepHy
     * @Description 查询待签列表
     * @Date 14:37 2025/8/6
     * @Param
     * @return
     **/
    List<AppContractSign> queryWaitSignList(String orderId);

    /**
     * @Author SheepHy
     * @Description 获取用户签署合同列表
     * @Date 14:37 2025/8/6
     * @Param
     * @return
     **/
    IPage<ContractSignVO> queryUserSignContractList(ContractSignDTO contractSignDTO);
}
