import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DmsBillsMaintDetailProjectVO, DmsBillsMaintDetailProjectForm, DmsBillsMaintDetailProjectQuery } from '@/api/dms/dmsBillsMaintDetailProject/types';

/**
 * 查询保养工单明细项目信息;检查每个项目的点巡检结果详情列表
 * @param query
 * @returns {*}
 */

export const listDmsBillsMaintDetailProject = (query?: DmsBillsMaintDetailProjectQuery): AxiosPromise<DmsBillsMaintDetailProjectVO[]> => {
  return request({
    url: '/dms/dmsBillsMaintDetailProject/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询保养工单明细项目信息;检查每个项目的点巡检结果详情详细
 * @param maintDetailProjectId
 */
export const getDmsBillsMaintDetailProject = (maintDetailProjectId: string | number): AxiosPromise<DmsBillsMaintDetailProjectVO> => {
  return request({
    url: '/dms/dmsBillsMaintDetailProject/' + maintDetailProjectId,
    method: 'get'
  });
};

/**
 * 新增保养工单明细项目信息;检查每个项目的点巡检结果详情
 * @param data
 */
export const addDmsBillsMaintDetailProject = (data: DmsBillsMaintDetailProjectForm) => {
  return request({
    url: '/dms/dmsBillsMaintDetailProject',
    method: 'post',
    data: data
  });
};

/**
 * 修改保养工单明细项目信息;检查每个项目的点巡检结果详情
 * @param data
 */
export const updateDmsBillsMaintDetailProject = (data: DmsBillsMaintDetailProjectForm) => {
  return request({
    url: '/dms/dmsBillsMaintDetailProject',
    method: 'put',
    data: data
  });
};

/**
 * 删除保养工单明细项目信息;检查每个项目的点巡检结果详情
 * @param maintDetailProjectId
 */
export const delDmsBillsMaintDetailProject = (maintDetailProjectId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/dmsBillsMaintDetailProject/' + maintDetailProjectId,
    method: 'delete'
  });
};


/**
 * 下拉框查询保养工单明细项目信息;检查每个项目的点巡检结果详情列表
 * @param query
 * @returns {*}
 */
export function getDmsBillsMaintDetailProjectList (query) {
    return request({
        url: '/dms/dmsBillsMaintDetailProject/getDmsBillsMaintDetailProjectList',
        method: 'get',
        params: query
    });
};
