import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ServerItemVO, ServerItemForm, ServerItemQuery } from '@/api/customer/serverItem/types';

/**
 * 查询维保服务内容列表
 * @param query
 * @returns {*}
 */

export const listServerItem = (query?: ServerItemQuery): AxiosPromise<ServerItemVO[]> => {
  return request({
    url: '/customer/serverItem/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询维保服务内容详细
 * @param id
 */
export const getServerItem = (id: string | number): AxiosPromise<ServerItemVO> => {
  return request({
    url: '/customer/serverItem/' + id,
    method: 'get'
  });
};

/**
 * 新增维保服务内容
 * @param data
 */
export const addServerItem = (data: ServerItemForm) => {
  return request({
    url: '/customer/serverItem',
    method: 'post',
    data: data
  });
};

/**
 * 修改维保服务内容
 * @param data
 */
export const updateServerItem = (data: ServerItemForm) => {
  return request({
    url: '/customer/serverItem',
    method: 'put',
    data: data
  });
};

/**
 * 删除维保服务内容
 * @param id
 */
export const delServerItem = (id: string | number | Array<string | number>) => {
  return request({
    url: '/customer/serverItem/' + id,
    method: 'delete'
  });
};
