import { ResPage, StoreUser } from "@/api/interface/index";
import { PORT_NONE } from "@/api/config/servicePort";
import http from "@/api";
import http_store from "@/api/indexStore";

// 获取营业执照
export const getBusinessLicense = params => {
  return http.get(PORT_NONE + `/license/querybusinessLicenseList`, params);
};

// 获取食品经营许可证
export const getFoodBusinessLicense = params => {
  return http.get(PORT_NONE + `/license/queryFoodLicenceList`, params);
};

// 获取其他资质证明
export const getEntertainmentBusinessLicense = params => {
  return http.get(PORT_NONE + `/license/queryEntertainmentLicenseList`, params);
};

// 获取合同图片列表
export const getContractImages = params => {
  return http.get(PORT_NONE + `/license/queryContractList`, params);
};

// 获取合同变更记录
export const queryContractByStatusList = params => {
  return http.get(PORT_NONE + `/license/queryContractByStatusList`, params);
};

// 获取食品经营许可证变更记录
export const getChangeRecords = params => {
  return http.get(PORT_NONE + `/license/queryLicenceByStatusList`, params);
};

// 获取营业执照变更记录
export const getBusinessLicenseChangeRecords = params => {
  return http.get(PORT_NONE + `/license/queryBusinessLicenseByStatusList`, params);
};

// 获取其他资质证明变更记录
export const getEntertainmentChangeRecords = params => {
  return http.get(PORT_NONE + `/license/queryEntertainmentByStatusList`, params);
};
// 获取合同审核状态
export const getStoreContractStatus = params => {
  return http.get(PORT_NONE + `/license/getStoreContractStatus`, params);
};

// 获取营业执照审核状态
export const getStoreBusinessLicenseStatus = params => {
  return http.get(PORT_NONE + `/license/getStoreBusinessLicenseStatus`, params);
};

// 获取食品经营许可证审核状态
export const getStoreFoodLicenceStatus = params => {
  return http.get(PORT_NONE + `/license/getStoreFoodLicenceStatus`, params);
};

// 获取其他资质证明审核状态
export const getStoreEntertainmentLicenceStatus = params => {
  return http.get(PORT_NONE + `/license/queryStoreEntertainmentStatus`, params);
};

// 提交营业执照审核
export const submitBusinessLicenseReview = params => {
  return http.post(PORT_NONE + `/license/uploadBusinessLicense`, params);
};

// 提交食品经营许可证审核
export const submitFoodLicenseReview = params => {
  return http.post(PORT_NONE + `/license/uploadfoodLicence`, params);
};

// 提交其他资质证明审核
export const submitEntertainmentLicenseReview = params => {
  return http.post(PORT_NONE + `/license/uploadEntertainmentLicence`, params);
};

// 提交合同审核
export const submitContractReview = params => {
  return http.post(PORT_NONE + `/license/uploadRenewalContract`, params);
};

// 上传合同图片
export const uploadContractImage = (formData: FormData, onProgress?: (progress: number) => void) => {
  return http.upload("/file/uploadMore", formData, onProgress, import.meta.env.VITE_API_URL as string);
};

// OCR 二次校验接口
export const ocrRequestUrl = params => {
  return http_store.post(PORT_NONE + `/ali/ocrRequestUrl`, params);
};
