import api from './index'
import { axios } from '@/utils/request'

/**
 * 新增楼栋
 * @param {Object} parameter 保存参数
 * @returns Axios Promise
 */
export function save(parameter) {
    return axios({
        url: '/rooms/cesRoomBuildingFloor/save',
        method: 'post',
        data: parameter
    })
}

/**
 * 编辑楼栋/楼层
 * @param {Object} parameter edit param
 * @returns Axios Promise
 */
 export function modify(parameter) {
    return axios({
        url: '/rooms/cesRoomBuildingFloor/modify',
        method: 'put',
        data: parameter
    })
}

/**
 * 删除楼栋/楼层
 * @param {String} parameter edit param
 * @returns Axios Promise
 */
 export function remove(id) {
    return axios({
        url: '/rooms/cesRoomBuildingFloor/delete',
        method: 'delete',
        params: id
    })
}

/**
 * 获取楼栋楼层树
 * @param {Object} param
 * @returns Axios Promise
 */
export function buildingTree (param) {
    return axios({
        url: '/rooms/cesRoomBuildingFloor/tree',
        method: 'get',
        params: param
    })
}
/**
 * 批量添加房间
 * @param {Object} param
 * @returns
 */
export function saveBatch(param) {
    return axios({
        url: '/rooms/cesRooms/saveBatchRoom',
        method: 'post',
        data: param
    })
 }


 /**
 * 批量删除房间
 * @param {Object} param
 * @returns
 */
export function delBatch(param) {
    return axios({
        url: '/rooms/cesRooms/delete',
        method: 'delete',
        data: param
    })
 }

  /**
 * 删除所有
 * @param {Object} param
 * @returns
 */
export function delAll(param) {
    return axios({
        url: '/rooms/cesRooms/removeAll',
        method: 'delete',
        data: param
    })
 }

   /**
 * 编辑房间
 * @param {Object} param
 * @returns
 */
export function roomEdit(param) {
    return axios({
        url: '/rooms/cesRooms/modify',
        method: 'put',
        data: param
    })
 }
/**
 * 通过上级Id获取楼栋楼层
 * @param {Object} param
 * @returns Axios Promise
 */
export function queryFloorByParentId (param) {
    return axios({
        url: '/rooms/cesRoomBuildingFloor/queryByParentId',
        method: 'get',
        params: param
    })
}

/**
 * 通过楼层获取房间列表
 * @param {Object} param
 * @returns
 */
export function queryRoomByFloorId(param) {
    return axios({
        url: '/rooms/cesRooms/queryByFloorId',
        method: 'get',
        params: param
    })
}
