import { post } from "./axios";

async function useCorp(data) {
  const res = await post("sessionArchive", data);
  return res;
}

export async function getCorpMemberChatList({ page = 1, pageSize = 50, memberUserId }) {
  const res = await useCorp({ type: "getCorpMemberChatList", page, pageSize, corpId: sessionStorage.getItem("corpId"), memberUserId });
  return res;
}
export async function getCorpMemberChatRecord({ page = 1, pageSize = 10, memberUserId, customerUserId, msgIds, orderBy = "asc" }) {
  const res = await useCorp({ type: "getCorpMemberChatRecord", page, pageSize, corpId: sessionStorage.getItem("corpId"), memberUserId, customerUserId, msgIds, orderBy });
  return res;
}
export async function getSessionArchiveUserList() {
  const res = await useCorp({ type: "getSessionArchiveUserList", corpId: sessionStorage.getItem("corpId") });
  return res;
}

export async function getCorpSessionArchive() {
  const res = await useCorp({ type: "getCorpSessionArchive", corpId: sessionStorage.getItem("corpId") });
  return res;
}

export async function batchStorageSession() {
  const res = await useCorp({ type: "batchStorageSession", corpId: sessionStorage.getItem("corpId") });
  return res;
}
export async function searchChatRecord({ keyword, cursor, limit, permanentCode }) {
  const res = await useCorp({ type: "searchChatRecord", corpId: sessionStorage.getItem("corpId"), keyword, cursor, limit, permanentCode });
  return res;
}

export async function getChatCount() {
  const res = await useCorp({ type: "getChatCount", corpId: sessionStorage.getItem("corpId") });
  return res;
}

export async function getSummaryResult({ magList }) {
  const res = await useCorp({ type: "getSummaryResult", corpId: sessionStorage.getItem("corpId"), magList });
  return res;
}

export async function getRecommendResult({ magList, kbId }) {
  const res = await useCorp({ type: "getRecommendResult", corpId: sessionStorage.getItem("corpId"), magList, kbId });
  return res;
}

export async function getEmotionResult({ magList }) {
  const res = await useCorp({ type: "getEmotionResult", corpId: sessionStorage.getItem("corpId"), magList });
  return res;
}

export async function getToDayAllChatRecord({ memberUserId, customerUserId }) {
  const res = await useCorp({ type: "getToDayAllChatRecord", corpId: sessionStorage.getItem("corpId"), memberUserId, customerUserId });
  return res;
}

export async function getReplyChatRecord({ memberUserId, customerUserId }) {
  const res = await useCorp({ type: "getReplyChatRecord", corpId: sessionStorage.getItem("corpId"), memberUserId, customerUserId });
  return res;
}

export async function getDocumentList() {
  const res = await useCorp({ type: "getDocumentList", corpId: sessionStorage.getItem("corpId") });
  return res;
}
