import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DmsRepairInstanceDetailVO, DmsRepairInstanceDetailForm, DmsRepairInstanceDetailQuery } from '@/api/dms/dmsRepairInstanceDetail/types';

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

export const listDmsRepairInstanceDetail = (query?: DmsRepairInstanceDetailQuery): AxiosPromise<DmsRepairInstanceDetailVO[]> => {
  return request({
    url: '/dms/dmsRepairInstanceDetail/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询检修工单明细详细
 * @param repairInstanceDetailId
 */
export const getDmsRepairInstanceDetail = (repairInstanceDetailId: string | number): AxiosPromise<DmsRepairInstanceDetailVO> => {
  return request({
    url: '/dms/dmsRepairInstanceDetail/' + repairInstanceDetailId,
    method: 'get'
  });
};

/**
 * 新增检修工单明细
 * @param data
 */
export const addDmsRepairInstanceDetail = (data: DmsRepairInstanceDetailForm) => {
  return request({
    url: '/dms/dmsRepairInstanceDetail',
    method: 'post',
    data: data
  });
};

/**
 * 修改检修工单明细
 * @param data
 */
export const updateDmsRepairInstanceDetail = (data: DmsRepairInstanceDetailForm) => {
  return request({
    url: '/dms/dmsRepairInstanceDetail',
    method: 'put',
    data: data
  });
};

/**
 * 删除检修工单明细
 * @param repairInstanceDetailId
 */
export const delDmsRepairInstanceDetail = (repairInstanceDetailId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/dmsRepairInstanceDetail/' + repairInstanceDetailId,
    method: 'delete'
  });
};


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