import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DmsBaseMaintStationVO, DmsBaseMaintStationForm, DmsBaseMaintStationQuery } from '@/api/dms/dmsBaseMaintStation/types';

/**
 * 查询保养部位信息列表
 * @param query
 * @returns {*}
 */

export const listDmsBaseMaintStation = (query?: DmsBaseMaintStationQuery): AxiosPromise<DmsBaseMaintStationVO[]> => {
  return request({
    url: '/dms/dmsBaseMaintStation/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询保养部位信息详细
 * @param maintStationId
 */
export const getDmsBaseMaintStation = (maintStationId: string | number): AxiosPromise<DmsBaseMaintStationVO> => {
  return request({
    url: '/dms/dmsBaseMaintStation/' + maintStationId,
    method: 'get'
  });
};

/**
 * 新增保养部位信息
 * @param data
 */
export const addDmsBaseMaintStation = (data: DmsBaseMaintStationForm) => {
  return request({
    url: '/dms/dmsBaseMaintStation',
    method: 'post',
    data: data
  });
};

/**
 * 修改保养部位信息
 * @param data
 */
export const updateDmsBaseMaintStation = (data: DmsBaseMaintStationForm) => {
  return request({
    url: '/dms/dmsBaseMaintStation',
    method: 'put',
    data: data
  });
};

/**
 * 删除保养部位信息
 * @param maintStationId
 */
export const delDmsBaseMaintStation = (maintStationId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/dmsBaseMaintStation/' + maintStationId,
    method: 'delete'
  });
};


/**
 * 下拉框查询保养部位信息列表
 * @param query
 * @returns {*}
 */
export function getDmsBaseMaintStationList (query) {
    return request({
        url: '/dms/dmsBaseMaintStation/getDmsBaseMaintStationList',
        method: 'get',
        params: query
    });
};
