import { defHttp } from '/@/utils/http/axios';
import {
  OrderInfoParams,
  PageParams,
  ListGetResultModel,
  ExportExcelParams,
  ExportExcelModel,
} from './model';
import type { Result } from '/#/axios';

enum Api {
  pageList = '/basic-api/order/list',
  getOrderInfo = '/basic-api/order/info',
  prderConfirm = '/basic-api/order/confirm',
  shippingList = '/basic-api/shipping/list',
  brandList = '/basic-api/brand/queryAll',
  sendGoods = '/basic-api/order/sendGoods',
  exportExcel = '/basic-api/order/export',
}

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

export const ListApi = (params: PageParams) =>
  defHttp.post<ListGetResultModel>({
    url: Api.pageList,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
export const ShippingListApi = (params: PageParams) =>
  defHttp.post<ListGetResultModel>({
    url: Api.shippingList,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

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

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

export const GetOrderInfoApi = (params: OrderInfoParams) =>
  defHttp.get<ListGetResultModel>({
    url: Api.getOrderInfo,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
export const exportExcelApi = (params: ExportExcelParams) =>
  defHttp.post<ExportExcelModel>({
    url: Api.exportExcel,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
export const confirmOrder = (params: OrderInfoParams) =>
  defHttp.post<Result>({
    url: Api.prderConfirm,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
