import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PtRoomVO, PtRoomForm, PtRoomQuery } from '@/api/basics/room/ptRoom/types';
import { PtAreaVO } from '../ptArea/types';

/**
 * 查询房间定义列表
 * @param query
 * @returns {*}
 */
export const listPtRoom = (query?: PtRoomQuery): AxiosPromise<PtRoomVO[]> => {
  return request({
    url: '/backstage/room/ptRoom/list',
    method: 'get',
    params: query
  });
};
export const queryRoom2AreaList = (query?: PtRoomQuery): AxiosPromise<Map<number, PtAreaVO[]>> => {
  return request({
    url: '/backstage/room/ptRoom/queryRoom2AreaList',
    method: 'get',
    params: query
  });
};

/**
 * 查询房间定义详细
 * @param roomId
 */
export const getPtRoom = (roomId: string | number): AxiosPromise<PtRoomVO> => {
  return request({
    url: '/backstage/room/ptRoom/' + roomId,
    method: 'get'
  });
};

/**
 * 新增房间定义
 * @param data
 */
export const addPtRoom = (data: PtRoomForm) => {
  return request({
    url: '/backstage/room/ptRoom',
    method: 'post',
    data: data
  });
};

/**
 * 新增房间定义
 * @param data
 */
export const batchSet = (data: PtRoomForm) => {
  return request({
    url: '/backstage/room/ptRoom/batchSet',
    method: 'post',
    data: data
  });
};

/**
 * 修改房间定义
 * @param data
 */
export const updatePtRoom = (data: PtRoomForm) => {
  return request({
    url: '/backstage/room/ptRoom',
    method: 'put',
    data: data
  });
};

/**
 * 删除房间定义
 * @param roomId
 */
export const delPtRoom = (roomId: string | number | Array<string | number>) => {
  return request({
    url: '/backstage/room/ptRoom/' + roomId,
    method: 'delete'
  });
};
