import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DmsBaseStationProjectVO, DmsBaseStationProjectForm, DmsBaseStationProjectQuery } from '@/api/dms/dmsBaseStationProject/types';

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

export const listDmsBaseStationProject = (query?: DmsBaseStationProjectQuery): AxiosPromise<DmsBaseStationProjectVO[]> => {
  return request({
    url: '/dms/dmsBaseStationProject/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询保养部位关联项目信息详细
 * @param maintStationId
 */
export const getDmsBaseStationProject = (maintStationId: string | number): AxiosPromise<DmsBaseStationProjectVO> => {
  return request({
    url: '/dms/dmsBaseStationProject/' + maintStationId,
    method: 'get'
  });
};

/**
 * 新增保养部位关联项目信息
 * @param data
 */
export const addDmsBaseStationProject = (data: DmsBaseStationProjectForm) => {
  return request({
    url: '/dms/dmsBaseStationProject',
    method: 'post',
    data: data
  });
};

/**
 * 修改保养部位关联项目信息
 * @param data
 */
export const updateDmsBaseStationProject = (data: DmsBaseStationProjectForm) => {
  return request({
    url: '/dms/dmsBaseStationProject',
    method: 'put',
    data: data
  });
};

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


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