import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PtAreaVO, PtAreaForm, PtAreaQuery } from '@/api/basics/room/ptArea/types';

/**
 * 查询建筑物区域列表
 * @param query
 * @returns {*}
 */
export const listPtArea = (query?: PtAreaQuery): AxiosPromise<PtAreaVO[]> => {
  return request({
    url: '/backstage/room/ptArea/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询建筑物区域详细
 * @param areaId
 */
export const getPtArea = (areaId: string | number): AxiosPromise<PtAreaVO> => {
  return request({
    url: '/backstage/room/ptArea/' + areaId,
    method: 'get'
  });
};

/**
 * 新增建筑物区域
 * @param data
 */
export const addPtArea = (data: PtAreaForm) => {
  return request({
    url: '/backstage/room/ptArea',
    method: 'post',
    data: data
  });
};

/**
 * 修改建筑物区域
 * @param data
 */
export const updatePtArea = (data: PtAreaForm) => {
  return request({
    url: '/backstage/room/ptArea',
    method: 'put',
    data: data
  });
};

/**
 * 删除建筑物区域
 * @param areaId
 */
export const delPtArea = (areaId: string | number | Array<string | number>) => {
  return request({
    url: '/backstage/room/ptArea/' + areaId,
    method: 'delete'
  });
};
