import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DmsBaseInspectRouteVO, DmsBaseInspectRouteForm, DmsBaseInspectRouteQuery } from '@/api/dms/dmsBaseInspectRoute/types';

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

export const listDmsBaseInspectRoute = (query?: DmsBaseInspectRouteQuery): AxiosPromise<DmsBaseInspectRouteVO[]> => {
  return request({
    url: '/dms/dmsBaseInspectRoute/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询点巡检线路信息详细
 * @param inspectRouteId
 */
export const getDmsBaseInspectRoute = (inspectRouteId: string | number): AxiosPromise<DmsBaseInspectRouteVO> => {
  return request({
    url: '/dms/dmsBaseInspectRoute/' + inspectRouteId,
    method: 'get'
  });
};

/**
 * 新增点巡检线路信息
 * @param data
 */
export const addDmsBaseInspectRoute = (data: DmsBaseInspectRouteForm) => {
  return request({
    url: '/dms/dmsBaseInspectRoute',
    method: 'post',
    data: data
  });
};

/**
 * 修改点巡检线路信息
 * @param data
 */
export const updateDmsBaseInspectRoute = (data: DmsBaseInspectRouteForm) => {
  return request({
    url: '/dms/dmsBaseInspectRoute',
    method: 'put',
    data: data
  });
};

/**
 * 删除点巡检线路信息
 * @param inspectRouteId
 */
export const delDmsBaseInspectRoute = (inspectRouteId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/dmsBaseInspectRoute/' + inspectRouteId,
    method: 'delete'
  });
};


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