import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DmsBaseMaintProjectVO, DmsBaseMaintProjectForm, DmsBaseMaintProjectQuery } from '@/api/dms/dmsBaseMaintProject/types';

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

export const listDmsBaseMaintProject = (query?: DmsBaseMaintProjectQuery): AxiosPromise<DmsBaseMaintProjectVO[]> => {
  return request({
    url: '/dms/dmsBaseMaintProject/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询保养项目信息详细
 * @param maintProjectId
 */
export const getDmsBaseMaintProject = (maintProjectId: string | number): AxiosPromise<DmsBaseMaintProjectVO> => {
  return request({
    url: '/dms/dmsBaseMaintProject/' + maintProjectId,
    method: 'get'
  });
};

/**
 * 新增保养项目信息
 * @param data
 */
export const addDmsBaseMaintProject = (data: DmsBaseMaintProjectForm) => {
  return request({
    url: '/dms/dmsBaseMaintProject',
    method: 'post',
    data: data
  });
};

/**
 * 修改保养项目信息
 * @param data
 */
export const updateDmsBaseMaintProject = (data: DmsBaseMaintProjectForm) => {
  return request({
    url: '/dms/dmsBaseMaintProject',
    method: 'put',
    data: data
  });
};

/**
 * 删除保养项目信息
 * @param maintProjectId
 */
export const delDmsBaseMaintProject = (maintProjectId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/dmsBaseMaintProject/' + maintProjectId,
    method: 'delete'
  });
};


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