import { defHttp } from '/@/utils/http/axios';
import {
  // PageParams,
  ListParams,
  RentListGetResultModel,
  SceneEditParam,
  SceneDownloadParam,
  GetDownloadProcessModel,
  UpdateParams,
} from './model';
import { Result } from '/#/axios';

enum Api {
  pageList = '/zfb-api/zfb/scene/pageList',
  generateSceneEditToken = '/zfb-api/zfb/api/platform/generateSceneEditToken',
  downloadSceneData = '/zfb-api/zfb/scene/downloadSceneData',
  getDownloadProcess = '/zfb-api/zfb/scene/getDownloadProcess',
  update = '/zfb-api/zfb/scene/update',
  listRooms = '/zfb-api/zfb/liveRoom/listRooms',
  bindUserList = '/zfb-api/zfb/brand/bindUserList',
  createOrUpdate = '/zfb-api/zfb/liveRoom/createOrUpdate',
  dismissRoom = '/zfb-api/zfb/liveRoom/dismissRoom',
  deleteRoom = '/zfb-api/zfb/liveRoom/deleteRoom',
  generateDefaultLiveRoom = '/zfb-api/zfb/scene/generateDefaultLiveRoom',
  generateReality = '/zfb-api/zfb/scene/createVrScene',
  getShareList = '/zfb-api/zfb/scene/getVRShareLinks',
}

/**
 * @description: Get sample list value
 */

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

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

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

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

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

export const listRoomsApi = (params: UpdateParams) =>
  defHttp.post<Result>({
    url: Api.listRooms,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
export const ListApi = (params: ListParams) =>
  defHttp.post<RentListGetResultModel>({
    url: Api.pageList,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const downloadSceneDataAPi = (params: SceneDownloadParam) =>
  defHttp.get<Result>({
    url: Api.downloadSceneData,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
export const getDownloadProcessApi = (params: SceneDownloadParam) =>
  defHttp.get<GetDownloadProcessModel>({
    url: Api.getDownloadProcess,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const generateSceneEditTokenApi = (params: SceneEditParam) =>
  defHttp.post<Result>({
    url: Api.generateSceneEditToken,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
export const generateDefaultLiveRoomApi = (params: SceneDownloadParam) =>
  defHttp.post<Result>({
    url: Api.generateDefaultLiveRoom,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

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

export const getShareListApi = (params: SceneDownloadParam) =>
  defHttp.post<Result>(
    {
      url: Api.getShareList,
      params,
      headers: {
        // @ts-ignore
        ignoreCancelToken: true,
      },
    },
    {
      useResult: true,
    },
  );
