import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MaintenanceTypeVO, MaintenanceTypeForm, MaintenanceTypeQuery } from '@/api/customer/maintenanceType/types';

/**
 * 查询维保类型列表
 * @param query
 * @returns {*}
 */

export const listMaintenanceType = (query?: MaintenanceTypeQuery): AxiosPromise<MaintenanceTypeVO[]> => {
  return request({
    url: '/customer/maintenanceType/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询维保类型详细
 * @param id
 */
export const getMaintenanceType = (id: string | number): AxiosPromise<MaintenanceTypeVO> => {
  return request({
    url: '/customer/maintenanceType/' + id,
    method: 'get'
  });
};

/**
 * 新增维保类型
 * @param data
 */
export const addMaintenanceType = (data: MaintenanceTypeForm) => {
  return request({
    url: '/customer/maintenanceType',
    method: 'post',
    data: data
  });
};

/**
 * 修改维保类型
 * @param data
 */
export const updateMaintenanceType = (data: MaintenanceTypeForm) => {
  return request({
    url: '/customer/maintenanceType',
    method: 'put',
    data: data
  });
};

/**
 * 删除维保类型
 * @param id
 */
export const delMaintenanceType = (id: string | number | Array<string | number>) => {
  return request({
    url: '/customer/maintenanceType/' + id,
    method: 'delete'
  });
};
