package org.sistema.hibernate.onetomanybidirannotations.models;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

/**
 * Player class
 * @author Eugenia Pérez Martínez
 * @email eugenia_perez@cuatrovientos.org
 */
@Entity
public class Player {

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;
	private String name;
	private Integer number;
	
	@ManyToOne
	private Team team;
	
	/**
	 * default constructor
	 */
	public Player () {
	}
	
	/**
	 * @param id
	 * @param name
	 * @param number
	 * @param team
	 */
	public Player(Long id, String name, Integer number, Team team) {
		this.id = id;
		this.name = name;
		this.number = number;
		this.team = team;
	}
	
	/**
	 * @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 number
	 */
	public Integer getNumber() {
		return number;
	}
	
	/**
	 * @param number the number to set
	 */
	public void setNumber(Integer number) {
		this.number = number;
	}

	/**
	 * @return the team
	 */
	public Team getTeam() {
		return team;
	}

	/**
	 * @param team the team to set
	 */
	public void setTeam(Team team) {
		this.team = team;
	}

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