package com.tandbergtv.workflow.auth;

import java.util.HashSet;
import java.util.Set;

public class Permission {
	private String name, displayName;
	private Set<String> menus;
	private Set<String> actions;
	private Set<String> sections;

	/**
	 * @return the menus
	 */
	public Set<String> getMenus() {
		return menus;
	}

	/**
	 * @param menus the menus to set
	 */
	public void setMenus(Set<String> menus) {
		this.menus = menus;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the displayName
	 */
	public String getDisplayName() {
		return displayName;
	}

	/**
	 * @param displayName the displayName to set
	 */
	public void setDisplayName(String displayName) {
		this.displayName = displayName;
	}

	/**
	 * @return the sections
	 */
	public Set<String> getSections() {
		return sections;
	}

	/**
	 * @param sections the sections to set
	 */
	public void setSections(Set<String> sections) {
		this.sections = sections;
	}

	/**
	 * @return the actions
	 */
	public Set<String> getActions() {
		return actions;
	}

	/**
	 * @param actions the actions to set
	 */
	public void setActions(Set<String> actions) {
		this.actions = actions;
	}
	
	/**
	 * @param menu	The menu to add to this permission
	 */
	public void addMenu(String menu) {
		if(menus == null)
			menus = new HashSet<String>();
		menus.add(menu);
	}
	
	/**
	 * @param action	The action to add to this permission
	 */
	public void addAction(String action) {
		if(actions == null)
			actions = new HashSet<String>();
		actions.add(action);
	}
	
	/**
	 * @param section	The section to add to this permission
	 */
	public void addSection(String section) {
		if(sections == null)
			sections = new HashSet<String>();
		sections.add(section);
	}
	
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "Name: " + name + ", Display Name: " + displayName
					+ "\nMenus: \n" + menus
					+ "\nActions: \n" + actions
					+ "\nSections: \n" + sections;
	}
}
