import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ServerTimeVO, ServerTimeForm, ServerTimeQuery } from '@/api/customer/serverTime/types';

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

export const listServerTime = (query?: ServerTimeQuery): AxiosPromise<ServerTimeVO[]> => {
  return request({
    url: '/customer/serverTime/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询维保服务时间详细
 * @param id
 */
export const getServerTime = (id: string | number): AxiosPromise<ServerTimeVO> => {
  return request({
    url: '/customer/serverTime/' + id,
    method: 'get'
  });
};

/**
 * 新增维保服务时间
 * @param data
 */
export const addServerTime = (data: ServerTimeForm) => {
  return request({
    url: '/customer/serverTime',
    method: 'post',
    data: data
  });
};

/**
 * 修改维保服务时间
 * @param data
 */
export const updateServerTime = (data: ServerTimeForm) => {
  return request({
    url: '/customer/serverTime',
    method: 'put',
    data: data
  });
};

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