import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ServiceOrderVO, ServiceOrderForm, ServiceOrderQuery } from '@/api/system/physical/serviceOrder/types';

/**
 * 查询实体服务订单管理列表
 * @param query
 * @returns {*}
 */

export const listServiceOrder = (query?: ServiceOrderQuery): AxiosPromise<ServiceOrderVO[]> => {
  return request({
    url: '/physical/serviceOrder/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询实体服务订单管理详细
 * @param id
 */
export const getServiceOrder = (id: string | number): AxiosPromise<ServiceOrderVO> => {
  return request({
    url: '/physical/serviceOrder/' + id,
    method: 'get'
  });
};

/**
 * 新增实体服务订单管理
 * @param data
 */
export const addServiceOrder = (data: ServiceOrderForm) => {
  return request({
    url: '/physical/serviceOrder',
    method: 'post',
    data: data
  });
};

/**
 * 修改实体服务订单管理
 * @param data
 */
export const updateServiceOrder = (data: ServiceOrderForm) => {
  return request({
    url: '/physical/serviceOrder',
    method: 'put',
    data: data
  });
};

/**
 * 删除实体服务订单管理
 * @param id
 */
export const delServiceOrder = (id: string | number | Array<string | number>) => {
  return request({
    url: '/physical/serviceOrder/' + id,
    method: 'delete'
  });
};
/**
 * 核销订单
 * @param data
 */
export const verifyOrder = (data: ServiceOrderForm) => {
  return request({
    url: '/physical/serviceOrder/verifyOrder',
    method: 'put',
    data: data
  });
};
