import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ArPointVO, ArPointForm, ArPointQuery } from '@/api/inspection/point/types';

/**
 * 查询巡检点位列表
 * @param query
 * @returns {*}
 */
export const listArPoint = (query?: ArPointQuery): AxiosPromise<ArPointVO[]> => {
  return request({
    url: '/inspection/point/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询巡检点位详细
 * @param id
 */
export const getArPoint = (id: string | number): AxiosPromise<ArPointVO> => {
  return request({
    url: '/inspection/point/' + id,
    method: 'get'
  });
};

/**
 * 新增巡检点位
 * @param data
 */
export const addArPoint = (data: ArPointForm) => {
  return request({
    url: '/inspection/point',
    method: 'post',
    data: data
  });
};

/**
 * 修改巡检点位
 * @param data
 */
export const updateArPoint = (data: ArPointForm) => {
  return request({
    url: '/inspection/point',
    method: 'put',
    data: data
  });
};

/**
 * 删除巡检点位
 * @param id
 */
export const delArPoint = (id: string | number | Array<string | number>) => {
  return request({
    url: '/inspection/point/' + id,
    method: 'delete'
  });
};
