package es.uv.saic.domain;

import java.io.Serializable;
import java.math.BigInteger;

import jakarta.persistence.*;

import java.util.Date;
import java.util.List;

/**
 * The persistent class for the instancies database table.
 * 
 */
@Entity
@Table(name="instancies")
@NamedQuery(name="Instancia.findAll", query="SELECT i FROM Instancia i")
public class Instancia implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="id_instancia")
	private BigInteger idInstancia;

	private Integer centre;

	private String estat;

	private Integer titulacio;
	
	@Temporal(TemporalType.DATE)
	@Column(name="data")
	private Date data;

	//bi-directional many-to-one association to Organ
	@ManyToOne
	@JoinColumns({
		@JoinColumn(name="lugar", referencedColumnName="lugar"),
		@JoinColumn(name="tlugar", referencedColumnName="tlugar")
		})
	private Organ organ;

	//bi-directional many-to-one association to Proces
	@ManyToOne
	@JoinColumn(name="id_proces")
	private Proces proces;

	//bi-directional many-to-one association to InstanciaTasca
	@OneToMany(mappedBy="instancia")
	private List<InstanciaTasca> instanciesTasques;

	public Instancia() {
	}

	public BigInteger getIdInstancia() {
		return this.idInstancia;
	}

	public void setIdInstancia(BigInteger idInstancia) {
		this.idInstancia = idInstancia;
	}

	public Integer getCentre() {
		return this.centre;
	}

	public void setCentre(Integer centre) {
		this.centre = centre;
	}

	public String getEstat() {
		return this.estat;
	}

	public void setEstat(String estat) {
		this.estat = estat;
	}

	public Integer getTitulacio() {
		return this.titulacio;
	}

	public void setTitulacio(Integer titulacio) {
		this.titulacio = titulacio;
	}
	
	public Date getData() {
		return data;
	}

	public void setData(Date data) {
		this.data = data;
	}

	public Organ getOrgan() {
		return this.organ;
	}

	public void setOrgan(Organ organ) {
		this.organ = organ;
	}

	public Proces getProces() {
		return this.proces;
	}

	public void setProces(Proces proces) {
		this.proces = proces;
	}

	public List<InstanciaTasca> getInstanciaTasca() {
		return this.instanciesTasques;
	}

	public void setInstanciaTasca(List<InstanciaTasca> instanciaTasca) {
		this.instanciesTasques = instanciaTasca;
	}

	public InstanciaTasca addInstanciaTasca(InstanciaTasca instanciaTasca) {
		getInstanciaTasca().add(instanciaTasca);
		instanciaTasca.setInstancia(this);

		return instanciaTasca;
	}

	public InstanciaTasca removeInstanciaTasca(InstanciaTasca instanciaTasca) {
		getInstanciaTasca().remove(instanciaTasca);
		instanciaTasca.setInstancia(null);

		return instanciaTasca;
	}

}