package com.bocloud.ims.interfaces.resource;

import com.bocloud.common.model.*;
import com.bocloud.ims.entity.resource.Rack;
import com.bocloud.ims.entity.resource.Room;
import com.bocloud.ims.entity.resource.Server;

import java.util.List;
import java.util.Map;


/**
 * 机房抽象Service接口
 * 
 * @author wei wei
 * @version 1.0
 * @since 2016.02.27
 */
public interface RoomService {

	/**
	 * 添加机房
	 * 
	 * @param room the room
	 * @return the result
	 */
	public BocloudResult<Room> create(Room room, Long userId);

	/**
	 * 更新机房
	 * 
	 * @param bean   the room bean
	 * @param userId the user id
	 * @return the result
	 */
	public BocloudResult<String> modify(Room bean, Long userId);

	/**
	 * 逻辑删除机房
	 * 
	 * @param id the id
	 * @param id the user id
	 * @return the result
	 */
	public BocloudResult<String> remove(Long id, Long userId);

	/**
	 * 查询机房详细
	 * 
	 * @param id the id
	 * @return the result
	 */
	public BocloudResult<Room> basic(Long id);

	/**
	 * 查询机房列表
	 * 
	 * @param page   the page
	 * @param rows   the rows
	 * @param params the params
	 * @param sorter the sorter
	 * @param simple the simple
	 * @return the result
	 */
	public BocloudResult<GridBean<Room>> list(Pager pager, RequestContext context);

	/**
	 * 得到当前机房下的机柜列表
	 * 
	 * @param page   the page
	 * @param rows   the rows
	 * @param params the params
	 * @param sorter the sorter
	 * @return the result
	 */
	public BocloudResult<GridBean<Rack>> listRacks(int page, int rows, List<Param> params, Map<String, String> sorter);

	/**
	 * 得到当前机房的基本信息和统计信息
	 * 
	 * @param id the id
	 * @return the result
	 */
	public BocloudResult<Room> detail(Long id);

	/**
	 * 加入数据中心
	 * 
	 * @param id     the room id
	 * @param dcId   the dataCenter id
	 * @param userId the user id
	 * @return the result
	 */
	public BocloudResult<String> inDC(Long id, Long dcId, Long userId);

	/**
	 * 移出数据中心
	 * 
	 * @param id     the room id
	 * @param userId the user id
	 * @return the result
	 */
	public BocloudResult<String> outDC(Long id, Long userId);

	/**
	 * 查询空闲机房列表
	 * 
	 * @return the room list
	 */
	public BocloudResult<List<Room>> freeRooms();

	/**
	 * 检查机柜位置是否被使用
	 * 
	 * @param id    the id
	 * @param axisX the axisX
	 * @param axisY the axisY
	 * @return the result
	 */
	public BocloudResult<String> checkPoint(Long id, Integer axisX, Integer axisY);

	/**
	 * 机房下没有分配的服务器
	 * 
	 * @param id the id
	 * @return the result
	 */
	public BocloudResult<List<Server>> freeNodes(Long id);

	/**
	 * 机房下没有分配的服务器
	 * 
	 * @param id the id
	 * @return the result
	 */
	public BocloudResult<List<Server>> freeManagers(Long id);

	/**
	 * 查询详情 and baseinfo
	 * 
	 * @param id
	 * @param action
	 * @return
	 */
	public BocloudResult<Room> details(Long id, String action);

	public BocloudResult<List<Room>> condition(String condition, RequestContext context);
}
