package ar.com.estigiait.app.entity;

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

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.codehaus.jackson.annotate.JsonIgnore;

/**
 * This class represents a JPA entity which is used to store client details.
 * 
 * @author Juan Vargas <juan.vargas@estigiait.com.ar>
 *
 */
@Entity
@Table(name="GENERIC_EVENT_APP")
public class GenericEvent implements Serializable{
	
	
	/**
     * Randomly generated serialVersionUID
     **/
	private static final long serialVersionUID = 720396641491391961L;

	@Id
	@Column(name="ID", nullable=false)
	@GeneratedValue(strategy=GenerationType.TABLE)
	private Long id;
		
	@Column(name="START_DATE", nullable=false)
	private Date startDate;
	
	@Column(name="ENDING_DATE", nullable=false)
	private Date endingDate;
   
	@Column(name="DESCRIPTION", nullable=false)
	private String description;
	
	@Column(name="DELETED", nullable=false, columnDefinition = "TINYINT(1)  DEFAULT 0")
	private boolean deleted;
	
    /**
     * veterinary associated with generic event
     **/
	@JsonIgnore
   	@ManyToOne(
		   fetch=FetchType.LAZY,	
		   cascade = CascadeType.PERSIST)
   	@JoinColumn(
		   name="veterinary",
		   referencedColumnName="ID" )
   	private Veterinary veterinary;
	
	
    /**
     * visit associated with generic event
     **/
	@JsonIgnore
   	@ManyToOne(
		   fetch=FetchType.LAZY,	
		   cascade = CascadeType.PERSIST)
   	@JoinColumn(
		   name="visit",
		   referencedColumnName="ID" )
   	private Visit visit;
	
	public GenericEvent(){
				
	}
	
	public Long getId() {
		return id;
	}

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

	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getEndingDate() {
		return endingDate;
	}

	public void setEndingDate(Date endingDate) {
		this.endingDate = endingDate;
	}
		
	public String getDescription() {
		return description;
	}

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

	public boolean isDeleted() {
		return deleted;
	}

	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}

	public Veterinary getVeterinary() {
		return veterinary;
	}

	public void setVeterinary(Veterinary veterinary) {
		this.veterinary = veterinary;
	}
	
}
