import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ArRegionVO, ArRegionForm, ArRegionQuery } from '@/api/inspection/region/types';

/**
 * 查询巡检区域列表
 * @param query
 * @returns {*}
 */
export const listArRegion = (query?: ArRegionQuery): AxiosPromise<ArRegionVO[]> => {
  return request({
    url: '/inspection/region/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询巡检区域详细
 * @param id
 */
export const getArRegion = (id: string | number): AxiosPromise<ArRegionVO> => {
  return request({
    url: '/inspection/region/' + id,
    method: 'get'
  });
};

/**
 * 新增巡检区域
 * @param data
 */
export const addArRegion = (data: ArRegionForm) => {
  return request({
    url: '/inspection/region',
    method: 'post',
    data: data
  });
};

/**
 * 修改巡检区域
 * @param data
 */
export const updateArRegion = (data: ArRegionForm) => {
  return request({
    url: '/inspection/region',
    method: 'put',
    data: data
  });
};

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