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

enum Api {
  pageList = '/zfb-api/zfb/goods/list',
  ref = '/zfb-api/zfb/specification/list',
  unSale = '/zfb-api/zfb/goods/unSale',
  enSale = '/zfb-api/zfb/goods/enSale',
  delete = '/zfb-api/zfb/goods/delete',
  info = '/zfb-api/zfb/goods/info/',
  update = '/zfb-api/zfb/goods/update',
  save = '/zfb-api/zfb/goods/save',
  queryAll = '/zfb-api/zfb/specification/queryAll',
}

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

export const queryAll = (params?: PageParams) =>
  defHttp.post<RentListGetResultModel>({
    url: Api.queryAll,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
export const ListApi = (params: PageParams) =>
  defHttp.post<RentListGetResultModel>({
    url: Api.pageList,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
export const InfoApi = (params: string) =>
  defHttp.post<any>({
    url: Api.info + params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
export const UnSaleApi = (params: string[]) =>
  defHttp.post<Result>({
    url: Api.unSale,
    data: params.join(','),
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

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

export const UpdateSaleApi = (params: any) =>
  defHttp.post<Result>({
    url: Api.update,
    data: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
export const EnSaleApi = (params: string[]) =>
  defHttp.post<Result>({
    url: Api.enSale,
    data: params.join(','),
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
export const DeleteApi = (params: string[]) =>
  defHttp.post<Result>({
    url: Api.delete,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
