package com.ibtp.kontor.tradingcards.entity;

import java.util.ArrayList;
import java.util.Collection;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name="PLAYER")
public class PlayerEntity {
	private Long id;
	private TeamEntity team;
	private Collection<SportCardEntity> cards = new ArrayList<SportCardEntity>();

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public Long getId() { return id; }
	
	@SuppressWarnings("unused")
	private void setId(Long id) { this.id = id; }

	@ManyToOne
	public TeamEntity getTeam() {
		return team;
	}

	public void setTeam(TeamEntity team) {
		this.team = team;
	}

	@OneToMany(mappedBy="player", cascade=CascadeType.REMOVE)
	public Collection<SportCardEntity> getCards() {
		return cards;
	}

	public void setCards(Collection<SportCardEntity> cards) {
		this.cards = cards;
	}
}
