package info.bukova.isspst.data;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "ROOM")
public class Room {

	@Id
	@Column(name = "ID")
	@GeneratedValue
	private int id;
	@Column(name = "CODE")
	private String code;
	@Column(name = "SHORTCUT")
	private String shortcut;
	@Column(name = "NAME")
	private String name;
	@Column(name = "FLOOR")
	private Integer floor;
	@Column(name = "NUMBER")
	private Integer number;
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "BUILDING_ID")
	private Building building;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getShortcut() {
		return shortcut;
	}

	public void setShortcut(String shortcut) {
		this.shortcut = shortcut;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getFloor() {
		return floor;
	}

	public void setFloor(Integer floor) {
		this.floor = floor;
	}

	public Integer getNumber() {
		return number;
	}

	public void setNumber(Integer number) {
		this.number = number;
	}

	public Building getBuilding() {
		return building;
	}

	public void setBuilding(Building building) {
		this.building = building;
	}
	
	public boolean equals(Object o) {
		return ((o instanceof Room) && (((Room)o).getId() == this.getId())); 
	}

}
