package es.uv.saic.domain;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.NamedQuery;
import jakarta.persistence.Table;
import jakarta.persistence.Temporal;
import jakarta.persistence.TemporalType;
import jakarta.persistence.Transient;

@Entity
@Table(name="calendari")
@NamedQuery(name="Calendari.findAll", query="SELECT t FROM Calendari t")
public class Calendari implements Serializable {
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name="id_calendari")
	private Integer idCalendari;
	
	private Integer tipus;
	
	@Column(name="titol_cas")
	private String titolCas;
	
	@Column(name="titol_val")
	private String titolVal;
	
	private String ambit;
	
	@Temporal(TemporalType.DATE)
	private Date data;
	
	@Transient
	private String dataStr;
	
	private Integer idProces;
	
	private String titulacions;
	
	private String centres;
	
	private String color;
	
	private String status;
	
	public Calendari() {}

	public Calendari(Integer idCalendari, Integer tipus, String titolCas, String titolVal, String ambit, Date data,
			Integer idProces, String titulacions, String centres, String color) {
		
		this.idCalendari = idCalendari;
		this.tipus = tipus;
		this.titolCas = titolCas;
		this.titolVal = titolVal;
		this.ambit = ambit;
		this.data = data;
		this.dataStr = new SimpleDateFormat("yyyy-MM-dd").format(data);
		this.idProces = idProces;
		this.titulacions = titulacions;
		this.centres = centres;
		this.color = color;
	}
	
	public Calendari(Integer idCalendari, Integer tipus, String titolCas, String titolVal, String ambit, Date data,
			Integer idProces, String titulacions, String centres, String color, String status) {
		
		this.idCalendari = idCalendari;
		this.tipus = tipus;
		this.titolCas = titolCas;
		this.titolVal = titolVal;
		this.ambit = ambit;
		this.data = data;
		this.dataStr = new SimpleDateFormat("yyyy-MM-dd").format(data);
		this.idProces = idProces;
		this.titulacions = titulacions;
		this.centres = centres;
		this.color = color;
		this.status = status;
	}

	public Integer getIdCalendari() {
		return idCalendari;
	}

	public void setIdCalendari(Integer idCalendari) {
		this.idCalendari = idCalendari;
	}

	public Integer getTipus() {
		return tipus;
	}

	public void setTipus(Integer tipus) {
		this.tipus = tipus;
	}

	public String getTitolCas() {
		return titolCas;
	}

	public void setTitolCas(String titolCas) {
		this.titolCas = titolCas;
	}

	public String getTitolVal() {
		return titolVal;
	}

	public void setTitolVal(String titolVal) {
		this.titolVal = titolVal;
	}

	public String getAmbit() {
		return ambit;
	}

	public void setAmbit(String ambit) {
		this.ambit = ambit;
	}

	public Date getData() {
		return data;
	}

	public void setData(Date data) {
		this.data = data;
		this.dataStr = new SimpleDateFormat("yyyy-MM-dd").format(data);
	}
	
	public String getDataStr() {
		return dataStr;
	}

	public void setDataStr(String dataStr) {
		this.dataStr = dataStr;
	}

	public Integer getIdProces() {
		return idProces;
	}

	public void setIdProces(Integer idProces) {
		this.idProces = idProces;
	}

	public String getTitulacions() {
		return titulacions;
	}

	public void setTitulacions(String titulacions) {
		this.titulacions = titulacions;
	}

	public String getCentres() {
		return centres;
	}

	public void setCentres(String centres) {
		this.centres = centres;
	}

	public String getColor() {
		return color;
	}

	public void setColor(String color) {
		this.color = color;
	}
	
	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	
}
