import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { OrderSetVO, OrderSetForm, OrderSetQuery } from '@/api/order/orderSet/types';

/**
 * 查询订单超时设置列表
 * @param query
 * @returns {*}
 */

export const listOrderSet = (query?: OrderSetQuery): AxiosPromise<OrderSetVO[]> => {
  return request({
    url: '/system/orderSet/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询订单超时设置详细
 * @param id
 */
export const getOrderSet = (id: string | number): AxiosPromise<OrderSetVO> => {
  return request({
    url: '/system/orderSet/' + id,
    method: 'get'
  });
};

/**
 * 新增订单超时设置
 * @param data
 */
export const addOrderSet = (data: OrderSetForm) => {
  return request({
    url: '/system/orderSet',
    method: 'post',
    data: data
  });
};

/**
 * 修改订单超时设置
 * @param data
 */
export const updateOrderSet = (data: OrderSetForm) => {
  return request({
    url: '/system/orderSet',
    method: 'put',
    data: data
  });
};

/**
 * 删除订单超时设置
 * @param id
 */
export const delOrderSet = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/orderSet/' + id,
    method: 'delete'
  });
};

export const getOrderSetData = (): AxiosPromise<OrderSetVO> => {
  return request({
    url: '/system/orderSet/getOrderSetData',
    method: 'get'
  });
};
