package org.sistema.hibernate.onetomanyunidirxml.models;

import java.util.ArrayList;
import java.util.List;

/**
 * Team class.
 * @author Eugenia Pérez Martínez
 * @email eugenia_perez@cuatrovientos.org
 */
public class Team {
	private Long id;
	private String name;
	private List<Player> players = new ArrayList<Player>();

	/**
	 * default constructor
	 */
	public Team () {
	}

	/**
	 * @param id
	 * @param name
	 * @param players
	 */
	public Team(Long id, String name, List<Player> players) {
		this.id = id;
		this.name = name;
		this.players = players;
	}
	
	/**
	 * Adds player to team
	 * @param player
	 */
	public void addPlayer (Player player) {
		players.add(player);
	}
	
	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the players
	 */
	public List<Player> getPlayers() {
		return players;
	}

	/**
	 * @param players the players to set
	 */
	public void setPlayers(List<Player> players) {
		this.players = players;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "Team [id=" + id + ", name=" + name + ", players=" + players
				+ "]";
	}
}
