import { defHttp } from '/@/utils/http/axios';
// PageParams
import { BasicStaticsParams, UserStaticsModel, BulletChatStaticsModel } from './model';
import { Result } from '/#/axios';

enum Api {
  bulletChat = '/zfb-api/zfb/platform/bulletChat/list',
  userStatics = '/zfb-api/zfb/platform/dashboard/liveRoom/userStatics',
  bulletChatStatics = '/zfb-api/zfb/platform/dashboard/liveRoom/bulletChatStatics',
  liveRoomStatics = '/zfb-api/zfb/platform/dashboard/company/liveRoomStatics',
  bulletChatExport = '/zfb-api/zfb/platform/bulletChat/export',
  companyChatExport = '/zfb-api/zfb/platform/dashboard/company/export',
}

//留言列表

export const bulletChatApi = (params: BasicStaticsParams) =>
  defHttp.post<Result>({
    url: Api.bulletChat,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

//企业看板

export const liveRoomStaticsApi = (params: BasicStaticsParams) =>
  defHttp.post<UserStaticsModel>({
    url: Api.liveRoomStatics,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
//留言统计
export const bulletChatStaticsApi = (params: BasicStaticsParams) =>
  defHttp.post<BulletChatStaticsModel>({
    url: Api.bulletChatStatics,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const userStaticsApi = (params: BasicStaticsParams) =>
  defHttp.post<UserStaticsModel>({
    url: Api.userStatics,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const bulletChatExportApi = (params: BasicStaticsParams) =>
  defHttp.post<Blob>(
    {
      url: Api.bulletChatExport,
      params,
      responseType: 'blob',
      headers: {
        // @ts-ignore
        ignoreCancelToken: true,
      },
    },
    {
      errorMessageMode: 'none',
    },
  );

export const companyChatExportApi = (params: BasicStaticsParams) =>
  defHttp.post<Blob>(
    {
      url: Api.companyChatExport,
      params,
      responseType: 'blob',
      headers: {
        // @ts-ignore
        ignoreCancelToken: true,
      },
    },
    {
      errorMessageMode: 'none',
    },
  );
