import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DmsPlanInspectVO, DmsPlanInspectForm, DmsPlanInspectQuery } from '@/api/dms/dmsPlanInspect/types';

/**
 * 查询点巡检计划信息列表
 * @param query
 * @returns {*}
 */

export const listDmsPlanInspect = (query?: DmsPlanInspectQuery): AxiosPromise<DmsPlanInspectVO[]> => {
  return request({
    url: '/dms/dmsPlanInspect/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询点巡检计划信息详细
 * @param planInspectId
 */
export const getDmsPlanInspect = (planInspectId: string | number): AxiosPromise<DmsPlanInspectVO> => {
  return request({
    url: '/dms/dmsPlanInspect/' + planInspectId,
    method: 'get'
  });
};

/**
 * 新增点巡检计划信息
 * @param data
 */
export const addDmsPlanInspect = (data: DmsPlanInspectForm) => {
  return request({
    url: '/dms/dmsPlanInspect',
    method: 'post',
    data: data
  });
};

/**
 * 修改点巡检计划信息
 * @param data
 */
export const updateDmsPlanInspect = (data: DmsPlanInspectForm) => {
  return request({
    url: '/dms/dmsPlanInspect',
    method: 'put',
    data: data
  });
};

/**
 * 删除点巡检计划信息
 * @param planInspectId
 */
export const delDmsPlanInspect = (planInspectId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/dmsPlanInspect/' + planInspectId,
    method: 'delete'
  });
};


/**
 * 下拉框查询点巡检计划信息列表
 * @param query
 * @returns {*}
 */
export function getDmsPlanInspectList (query) {
    return request({
        url: '/dms/dmsPlanInspect/getDmsPlanInspectList',
        method: 'get',
        params: query
    });
};
