import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DmsPlanMaintVO, DmsPlanMaintForm, DmsPlanMaintQuery } from '@/api/dms/dmsPlanMaint/types';

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

export const listDmsPlanMaint = (query?: DmsPlanMaintQuery): AxiosPromise<DmsPlanMaintVO[]> => {
  return request({
    url: '/dms/dmsPlanMaint/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询保养计划信息详细
 * @param planMaintId
 */
export const getDmsPlanMaint = (planMaintId: string | number): AxiosPromise<DmsPlanMaintVO> => {
  return request({
    url: '/dms/dmsPlanMaint/' + planMaintId,
    method: 'get'
  });
};

/**
 * 新增保养计划信息
 * @param data
 */
export const addDmsPlanMaint = (data: DmsPlanMaintForm) => {
  return request({
    url: '/dms/dmsPlanMaint',
    method: 'post',
    data: data
  });
};

/**
 * 修改保养计划信息
 * @param data
 */
export const updateDmsPlanMaint = (data: DmsPlanMaintForm) => {
  return request({
    url: '/dms/dmsPlanMaint',
    method: 'put',
    data: data
  });
};

/**
 * 删除保养计划信息
 * @param planMaintId
 */
export const delDmsPlanMaint = (planMaintId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/dmsPlanMaint/' + planMaintId,
    method: 'delete'
  });
};


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