package com.fp.armas.portal.model;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Version;


/**
 * The persistent class for the TGENECANTON database table.
 * 
 */
@Entity
public class Tgenecanton implements Serializable {
	private static final long serialVersionUID = 1L;

	@EmbeddedId
	private TgenecantonPK id;

	private String description;

	@Version
	private Long recordversion;

	//bi-directional many-to-one association to Tgeneprovince
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumns({
		@JoinColumn(name="COUNTRYCODE", referencedColumnName="COUNTRYCODE"),
		@JoinColumn(name="PROVINCECODE", referencedColumnName="PROVINCECODE")
		})
	private Tgeneprovince tgeneprovince;

	//bi-directional many-to-one association to Tgenecity
	@OneToMany(mappedBy="tgenecanton")
	private Set<Tgenecity> tgenecities;

	//bi-directional many-to-one association to Tgeneparroquia
	@OneToMany(mappedBy="tgenecanton")
	private Set<Tgeneparroquia> tgeneparroquias;

	public Tgenecanton() {
	}

	public TgenecantonPK getId() {
		return this.id;
	}

	public void setId(TgenecantonPK id) {
		this.id = id;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Long getRecordversion() {
		return this.recordversion;
	}

	public void setRecordversion(Long recordversion) {
		this.recordversion = recordversion;
	}

	public Tgeneprovince getTgeneprovince() {
		return this.tgeneprovince;
	}

	public void setTgeneprovince(Tgeneprovince tgeneprovince) {
		this.tgeneprovince = tgeneprovince;
	}

	public Set<Tgenecity> getTgenecities() {
		return this.tgenecities;
	}

	public void setTgenecities(Set<Tgenecity> tgenecities) {
		this.tgenecities = tgenecities;
	}

	public Tgenecity addTgenecity(Tgenecity tgenecity) {
		getTgenecities().add(tgenecity);
		tgenecity.setTgenecanton(this);

		return tgenecity;
	}

	public Tgenecity removeTgenecity(Tgenecity tgenecity) {
		getTgenecities().remove(tgenecity);
		tgenecity.setTgenecanton(null);

		return tgenecity;
	}

	public Set<Tgeneparroquia> getTgeneparroquias() {
		return this.tgeneparroquias;
	}

	public void setTgeneparroquias(Set<Tgeneparroquia> tgeneparroquias) {
		this.tgeneparroquias = tgeneparroquias;
	}

	public Tgeneparroquia addTgeneparroquia(Tgeneparroquia tgeneparroquia) {
		getTgeneparroquias().add(tgeneparroquia);
		tgeneparroquia.setTgenecanton(this);

		return tgeneparroquia;
	}

	public Tgeneparroquia removeTgeneparroquia(Tgeneparroquia tgeneparroquia) {
		getTgeneparroquias().remove(tgeneparroquia);
		tgeneparroquia.setTgenecanton(null);

		return tgeneparroquia;
	}

}