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 TGENEPARROQUIA database table.
 * 
 */
@Entity
public class Tgeneparroquia implements Serializable {
	private static final long serialVersionUID = 1L;

	@EmbeddedId
	private TgeneparroquiaPK id;

	private String description;

	@Version
	private Long recordversion;

	//bi-directional many-to-one association to Tcustpersonaddress
	@OneToMany(mappedBy="tgeneparroquia")
	private Set<Tcustpersonaddress> tcustpersonaddresses;

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

	public Tgeneparroquia() {
	}

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

	public void setId(TgeneparroquiaPK 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 Set<Tcustpersonaddress> getTcustpersonaddresses() {
		return this.tcustpersonaddresses;
	}

	public void setTcustpersonaddresses(Set<Tcustpersonaddress> tcustpersonaddresses) {
		this.tcustpersonaddresses = tcustpersonaddresses;
	}

	public Tcustpersonaddress addTcustpersonaddress(Tcustpersonaddress tcustpersonaddress) {
		getTcustpersonaddresses().add(tcustpersonaddress);
		tcustpersonaddress.setTgeneparroquia(this);

		return tcustpersonaddress;
	}

	public Tcustpersonaddress removeTcustpersonaddress(Tcustpersonaddress tcustpersonaddress) {
		getTcustpersonaddresses().remove(tcustpersonaddress);
		tcustpersonaddress.setTgeneparroquia(null);

		return tcustpersonaddress;
	}

	public Tgenecanton getTgenecanton() {
		return this.tgenecanton;
	}

	public void setTgenecanton(Tgenecanton tgenecanton) {
		this.tgenecanton = tgenecanton;
	}

}