package com.ibtp.kontor.tradingcards.entity;

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

import javax.persistence.CascadeType;
import javax.persistence.Column;
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="BASESET")
public class BaseSetEntity {
	private Long id;
	private String name;
	private ManufacturerEntity manufacturer;
	private Collection<ParallelSetEntity> parallelSets = new ArrayList<ParallelSetEntity>();
	private Collection<InsertEntity> inserts = new ArrayList<InsertEntity>();

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

	@Column
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@ManyToOne
	public ManufacturerEntity getManufacturer() {
		return manufacturer;
	}

	public void setManufacturer(ManufacturerEntity manufacturer) {
		this.manufacturer = manufacturer;
	}

	@OneToMany(mappedBy="baseSet", cascade=CascadeType.REMOVE)
	public Collection<ParallelSetEntity> getParallelSets() {
		return parallelSets;
	}

	public void setParallelSets(Collection<ParallelSetEntity> parallelSets) {
		this.parallelSets = parallelSets;
	}

	@OneToMany(mappedBy="baseSet", cascade=CascadeType.REMOVE)
	public Collection<InsertEntity> getInserts() {
		return inserts;
	}

	public void setInserts(Collection<InsertEntity> inserts) {
		this.inserts = inserts;
	}
}
