import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DmsPlanMaintDetailVO, DmsPlanMaintDetailForm, DmsPlanMaintDetailQuery } from '@/api/dms/dmsPlanMaintDetail/types';

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

export const listDmsPlanMaintDetail = (query?: DmsPlanMaintDetailQuery): AxiosPromise<DmsPlanMaintDetailVO[]> => {
  return request({
    url: '/dms/dmsPlanMaintDetail/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询保养计划明细详细
 * @param planMaintDetailId
 */
export const getDmsPlanMaintDetail = (planMaintDetailId: string | number): AxiosPromise<DmsPlanMaintDetailVO> => {
  return request({
    url: '/dms/dmsPlanMaintDetail/' + planMaintDetailId,
    method: 'get'
  });
};

/**
 * 新增保养计划明细
 * @param data
 */
export const addDmsPlanMaintDetail = (data: DmsPlanMaintDetailForm) => {
  return request({
    url: '/dms/dmsPlanMaintDetail',
    method: 'post',
    data: data
  });
};

/**
 * 修改保养计划明细
 * @param data
 */
export const updateDmsPlanMaintDetail = (data: DmsPlanMaintDetailForm) => {
  return request({
    url: '/dms/dmsPlanMaintDetail',
    method: 'put',
    data: data
  });
};

/**
 * 删除保养计划明细
 * @param planMaintDetailId
 */
export const delDmsPlanMaintDetail = (planMaintDetailId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/dmsPlanMaintDetail/' + planMaintDetailId,
    method: 'delete'
  });
};


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