import { defHttp } from '/@/utils/http/axios';
import { Result } from '/#/axios';
enum Api {
  mediaList = '/service/manage/dictFile/pageList/media-library',
  fileaddOrUpdate = '/service/manage/dictFile/addOrUpdate/media-library',
  dictFiledel = '/service/manage/dictFile/del/media-library',
  getByKey = '/service/manage/dict/getByKey/media-library',
  getpageList = '/service/manage/dict/pageList/media-library',
  addOrUpdate = '/service/manage/dict/addOrUpdate/media-library',
  del = '/service/manage/dict/del/media-library',
  upload = '/service/manage/common/upload/fileNew',
  getCaseNumByRyId = '/service/manage/case/getCaseNumByRyId',
}

/**
 * @description: Get sample list value
 */
export const mediaList = (params) =>
  defHttp.post<Result>({
    url: Api.mediaList,
    params: params,
    // data: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

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

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

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

export function uploadApi(params, onUploadProgress: (progressEvent: ProgressEvent) => void) {
  return defHttp.uploadFile<Result>(
    {
      url: Api.upload,
      onUploadProgress,
    },
    params,
  );
}
export const casePublicApi = (params) =>
  defHttp.get<Result>({
    url: Api.caseWithdraw,
    params: params,
    // data: params,
    headers: {
      // @ts-ignore
      'Content-Type': 'application/x-www-form-urlencoded',
      ignoreCancelToken: true,
    },
  });
