package com.fp.armas.portal.model;

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

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;


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

	@Id
	private String usercode;
	
	private Long personCode;

	private Long companycode;

	private Long internalcode;

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

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

	//bi-directional many-to-one association to Tcustpersondetail
	@OneToMany(mappedBy="tsafeuser1")
	private Set<Tcustpersondetail> tcustpersondetails1;

	//bi-directional many-to-one association to Tcustpersondetail
	@OneToMany(mappedBy="tsafeuser2")
	private Set<Tcustpersondetail> tcustpersondetails2;

	//bi-directional many-to-one association to Tcustperson
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="PERSONCODE", insertable=false, updatable=false)
	private Tcustperson tcustperson;

	//bi-directional many-to-one association to Tsafeuserdetail
	@OneToMany(mappedBy="tsafeuser")
	private Set<Tsafeuserdetail> tsafeuserdetails;

	//bi-directional many-to-one association to Tcustpersonphone
	@OneToMany(mappedBy="tsafeuser1")
	private Set<Tcustpersonphone> tcustpersonphones1;

	//bi-directional many-to-one association to Tcustpersonphone
	@OneToMany(mappedBy="tsafeuser2")
	private Set<Tcustpersonphone> tcustpersonphones2;

	//bi-directional many-to-one association to Tsafeuserprofile
	@OneToMany(mappedBy="tsafeuser")
	private Set<Tsafeuserprofile> tsafeuserprofiles;

	public Tsafeuser() {
	}

	public String getUsercode() {
		return this.usercode;
	}

	public void setUsercode(String usercode) {
		this.usercode = usercode;
	}

	public Long getCompanycode() {
		return this.companycode;
	}

	public void setCompanycode(Long companycode) {
		this.companycode = companycode;
	}

	public Long getInternalcode() {
		return this.internalcode;
	}

	public void setInternalcode(Long internalcode) {
		this.internalcode = internalcode;
	}

	public Set<Tcustpersonaddress> getTcustpersonaddresses1() {
		return this.tcustpersonaddresses1;
	}

	public void setTcustpersonaddresses1(Set<Tcustpersonaddress> tcustpersonaddresses1) {
		this.tcustpersonaddresses1 = tcustpersonaddresses1;
	}

	public Tcustpersonaddress addTcustpersonaddresses1(Tcustpersonaddress tcustpersonaddresses1) {
		getTcustpersonaddresses1().add(tcustpersonaddresses1);
		tcustpersonaddresses1.setTsafeuser1(this);

		return tcustpersonaddresses1;
	}

	public Tcustpersonaddress removeTcustpersonaddresses1(Tcustpersonaddress tcustpersonaddresses1) {
		getTcustpersonaddresses1().remove(tcustpersonaddresses1);
		tcustpersonaddresses1.setTsafeuser1(null);

		return tcustpersonaddresses1;
	}

	public Set<Tcustpersonaddress> getTcustpersonaddresses2() {
		return this.tcustpersonaddresses2;
	}

	public void setTcustpersonaddresses2(Set<Tcustpersonaddress> tcustpersonaddresses2) {
		this.tcustpersonaddresses2 = tcustpersonaddresses2;
	}

	public Tcustpersonaddress addTcustpersonaddresses2(Tcustpersonaddress tcustpersonaddresses2) {
		getTcustpersonaddresses2().add(tcustpersonaddresses2);
		tcustpersonaddresses2.setTsafeuser2(this);

		return tcustpersonaddresses2;
	}

	public Tcustpersonaddress removeTcustpersonaddresses2(Tcustpersonaddress tcustpersonaddresses2) {
		getTcustpersonaddresses2().remove(tcustpersonaddresses2);
		tcustpersonaddresses2.setTsafeuser2(null);

		return tcustpersonaddresses2;
	}

	public Set<Tcustpersondetail> getTcustpersondetails1() {
		return this.tcustpersondetails1;
	}

	public void setTcustpersondetails1(Set<Tcustpersondetail> tcustpersondetails1) {
		this.tcustpersondetails1 = tcustpersondetails1;
	}

	public Tcustpersondetail addTcustpersondetails1(Tcustpersondetail tcustpersondetails1) {
		getTcustpersondetails1().add(tcustpersondetails1);
		tcustpersondetails1.setTsafeuser1(this);

		return tcustpersondetails1;
	}

	public Tcustpersondetail removeTcustpersondetails1(Tcustpersondetail tcustpersondetails1) {
		getTcustpersondetails1().remove(tcustpersondetails1);
		tcustpersondetails1.setTsafeuser1(null);

		return tcustpersondetails1;
	}

	public Set<Tcustpersondetail> getTcustpersondetails2() {
		return this.tcustpersondetails2;
	}

	public void setTcustpersondetails2(Set<Tcustpersondetail> tcustpersondetails2) {
		this.tcustpersondetails2 = tcustpersondetails2;
	}

	public Tcustpersondetail addTcustpersondetails2(Tcustpersondetail tcustpersondetails2) {
		getTcustpersondetails2().add(tcustpersondetails2);
		tcustpersondetails2.setTsafeuser2(this);

		return tcustpersondetails2;
	}

	public Tcustpersondetail removeTcustpersondetails2(Tcustpersondetail tcustpersondetails2) {
		getTcustpersondetails2().remove(tcustpersondetails2);
		tcustpersondetails2.setTsafeuser2(null);

		return tcustpersondetails2;
	}

	public Tcustperson getTcustperson() {
		return this.tcustperson;
	}

	public void setTcustperson(Tcustperson tcustperson) {
		this.tcustperson = tcustperson;
	}

	public Set<Tsafeuserdetail> getTsafeuserdetails() {
		return this.tsafeuserdetails;
	}

	public void setTsafeuserdetails(Set<Tsafeuserdetail> tsafeuserdetails) {
		this.tsafeuserdetails = tsafeuserdetails;
	}

	public Tsafeuserdetail addTsafeuserdetail(Tsafeuserdetail tsafeuserdetail) {
		getTsafeuserdetails().add(tsafeuserdetail);
		tsafeuserdetail.setTsafeuser(this);

		return tsafeuserdetail;
	}

	public Tsafeuserdetail removeTsafeuserdetail(Tsafeuserdetail tsafeuserdetail) {
		getTsafeuserdetails().remove(tsafeuserdetail);
		tsafeuserdetail.setTsafeuser(null);

		return tsafeuserdetail;
	}

	public Set<Tcustpersonphone> getTcustpersonphones1() {
		return this.tcustpersonphones1;
	}

	public void setTcustpersonphones1(Set<Tcustpersonphone> tcustpersonphones1) {
		this.tcustpersonphones1 = tcustpersonphones1;
	}

	public Tcustpersonphone addTcustpersonphones1(Tcustpersonphone tcustpersonphones1) {
		getTcustpersonphones1().add(tcustpersonphones1);
		tcustpersonphones1.setTsafeuser1(this);

		return tcustpersonphones1;
	}

	public Tcustpersonphone removeTcustpersonphones1(Tcustpersonphone tcustpersonphones1) {
		getTcustpersonphones1().remove(tcustpersonphones1);
		tcustpersonphones1.setTsafeuser1(null);

		return tcustpersonphones1;
	}

	public Set<Tcustpersonphone> getTcustpersonphones2() {
		return this.tcustpersonphones2;
	}

	public void setTcustpersonphones2(Set<Tcustpersonphone> tcustpersonphones2) {
		this.tcustpersonphones2 = tcustpersonphones2;
	}

	public Tcustpersonphone addTcustpersonphones2(Tcustpersonphone tcustpersonphones2) {
		getTcustpersonphones2().add(tcustpersonphones2);
		tcustpersonphones2.setTsafeuser2(this);

		return tcustpersonphones2;
	}

	public Tcustpersonphone removeTcustpersonphones2(Tcustpersonphone tcustpersonphones2) {
		getTcustpersonphones2().remove(tcustpersonphones2);
		tcustpersonphones2.setTsafeuser2(null);

		return tcustpersonphones2;
	}

	public Set<Tsafeuserprofile> getTsafeuserprofiles() {
		return this.tsafeuserprofiles;
	}

	public void setTsafeuserprofiles(Set<Tsafeuserprofile> tsafeuserprofiles) {
		this.tsafeuserprofiles = tsafeuserprofiles;
	}

	public Tsafeuserprofile addTsafeuserprofile(Tsafeuserprofile tsafeuserprofile) {
		getTsafeuserprofiles().add(tsafeuserprofile);
		tsafeuserprofile.setTsafeuser(this);

		return tsafeuserprofile;
	}

	public Tsafeuserprofile removeTsafeuserprofile(Tsafeuserprofile tsafeuserprofile) {
		getTsafeuserprofiles().remove(tsafeuserprofile);
		tsafeuserprofile.setTsafeuser(null);

		return tsafeuserprofile;
	}

	public Long getPersonCode() {
		return personCode;
	}

	public void setPersonCode(Long personCode) {
		this.personCode = personCode;
	}

}