package hr.fer.zemris.ffr.desktop.formCreator.model;

import hr.fer.zemris.ffr.desktop.formCreator.I18NUtil;

public class PMRoom implements Comparable<PMRoom> {

	private String name;
	private int capacity;
	private boolean taken;
	
	public PMRoom(String name, int capacity) {
		super();
		this.name = name;
		this.capacity = capacity;
	}
	
	public boolean isTaken() {
		return taken;
	}
	
	public void setTaken(boolean taken) {
		this.taken = taken;
	}
	
	public int getCapacity() {
		return capacity;
	}
	
	public void setCapacity(int capacity) {
		this.capacity = capacity;
	}
	
	public String getName() {
		return name;
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		PMRoom other = (PMRoom) obj;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}
	
	@Override
	public String toString() {
		return name+" ("+capacity+")";
	}
	
	@Override
	public int compareTo(PMRoom o) {
		return I18NUtil.getSortingCollator().compare(this.name, o.name);
	}
}
