package com.group.robot.info;

/**
 * 房间信息类
 */
public class RoomInfo {
    private String roomId;         // 房间ID
    private int wanfaId;            // 玩法类型ID
    private int groupId;           // 圈子ID
    private int currentPlayers;    // 当前玩家数
    private int maxPlayers;        // 最大玩家数
    private String gameServerHost; // 游戏服务器主机
    private int gameServerPort;    // 游戏服务器端口
    private String game;           // 游戏标识
    private String gpid;           // 游戏玩法ID
    private long createTime;       // 创建时间
    private boolean isFull;        // 是否已满员
    private boolean isEmpty;       // 是否为空房间
    
    public RoomInfo() {
        this.createTime = System.currentTimeMillis();
    }
    
    public String getRoomId() {
        return roomId;
    }
    
    public void setRoomId(String roomId) {
        this.roomId = roomId;
    }
    
    public int getWanfaId() {
        return wanfaId;
    }
    
    public void setWanfaId(int wanfaId) {
        this.wanfaId = wanfaId;
    }
    
    public int getGroupId() {
        return groupId;
    }
    
    public void setGroupId(int groupId) {
        this.groupId = groupId;
    }
    
    public int getCurrentPlayers() {
        return currentPlayers;
    }
    
    public void setCurrentPlayers(int currentPlayers) {
        this.currentPlayers = currentPlayers;
        this.isFull = currentPlayers >= getMaxPlayers();
        this.isEmpty = currentPlayers == 0;
    }
    
    public int getMaxPlayers() {
        return maxPlayers;
    }
    
    public void setMaxPlayers(int maxPlayers) {
        this.maxPlayers = maxPlayers;
        this.isFull = currentPlayers >= maxPlayers;
    }
    
    public String getGameServerHost() {
        return gameServerHost;
    }
    
    public void setGameServerHost(String gameServerHost) {
        this.gameServerHost = gameServerHost;
    }
    
    public int getGameServerPort() {
        return gameServerPort;
    }
    
    public void setGameServerPort(int gameServerPort) {
        this.gameServerPort = gameServerPort;
    }
    
    public String getGame() {
        return game;
    }
    
    public void setGame(String game) {
        this.game = game;
    }
    
    public String getGpid() {
        return gpid;
    }
    
    public void setGpid(String gpid) {
        this.gpid = gpid;
    }
    
    public long getCreateTime() {
        return createTime;
    }
    
    public void setCreateTime(long createTime) {
        this.createTime = createTime;
    }
    
    public boolean isFull() {
        return isFull;
    }
    
    public void setFull(boolean full) {
        isFull = full;
    }
    
    public boolean isEmpty() {
        return isEmpty;
    }
    
    public void setEmpty(boolean empty) {
        isEmpty = empty;
    }
    
    @Override
    public String toString() {
        return "RoomInfo{" +
                "roomId='" + roomId + '\'' +
                ", wanfaId=" + wanfaId +
                ", groupId=" + groupId +
                ", currentPlayers=" + currentPlayers +
                ", maxPlayers=" + maxPlayers +
                ", gameServerHost='" + gameServerHost + '\'' +
                ", gameServerPort=" + gameServerPort +
                ", isFull=" + isFull +
                ", isEmpty=" + isEmpty +
                '}';
    }
}