import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DmsPlanRepairDetailVO, DmsPlanRepairDetailForm, DmsPlanRepairDetailQuery } from '@/api/dms/dmsPlanRepairDetail/types';

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

export const listDmsPlanRepairDetail = (query?: DmsPlanRepairDetailQuery): AxiosPromise<DmsPlanRepairDetailVO[]> => {
  return request({
    url: '/dms/dmsPlanRepairDetail/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询检修计划明细详细
 * @param planRepairDetailId
 */
export const getDmsPlanRepairDetail = (planRepairDetailId: string | number): AxiosPromise<DmsPlanRepairDetailVO> => {
  return request({
    url: '/dms/dmsPlanRepairDetail/' + planRepairDetailId,
    method: 'get'
  });
};

/**
 * 新增检修计划明细
 * @param data
 */
export const addDmsPlanRepairDetail = (data: DmsPlanRepairDetailForm) => {
  return request({
    url: '/dms/dmsPlanRepairDetail',
    method: 'post',
    data: data
  });
};

/**
 * 修改检修计划明细
 * @param data
 */
export const updateDmsPlanRepairDetail = (data: DmsPlanRepairDetailForm) => {
  return request({
    url: '/dms/dmsPlanRepairDetail',
    method: 'put',
    data: data
  });
};

/**
 * 删除检修计划明细
 * @param planRepairDetailId
 */
export const delDmsPlanRepairDetail = (planRepairDetailId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/dmsPlanRepairDetail/' + planRepairDetailId,
    method: 'delete'
  });
};


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