package com.rjconsultores.ventaboletos.entidad;

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

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.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@SequenceGenerator(name = "COM_EMP_TIPOEVENTOEXTRA_SEQ", sequenceName = "COM_EMP_TIPOEVENTOEXTRA_SEQ", allocationSize = 1)
@Table(name = "COM_EMP_TIPOEVENTOEXTRA")
public class ComEmpTipoEventoExtra implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "COMEMPTIPOEVENTOEXTRA_ID")
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "COM_EMP_TIPOEVENTOEXTRA_SEQ")
	private Long comemptipoeventoextraId;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "EMPRESA_ID")
	private Empresa empresa;
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "TIPOEVENTOEXTRA_ID")
	private TipoEventoExtra tipoEventoExtra;
	
	@Column(name = "ACTIVO")
	private boolean activo;
	@Column(name = "USUARIO_ID")
	private Integer usuarioId;
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "FECMODIF")
	private Date fecmodif;

	public Long getComemptipoeventoextraId() {
		return comemptipoeventoextraId;
	}

	public void setComemptipoeventoextraId(Long comemptipoeventoextraId) {
		this.comemptipoeventoextraId = comemptipoeventoextraId;
	}

	public Empresa getEmpresa() {
		return empresa;
	}

	public void setEmpresa(Empresa empresa) {
		this.empresa = empresa;
	}

	public TipoEventoExtra getTipoEventoExtra() {
		return tipoEventoExtra;
	}

	public void setTipoEventoExtra(TipoEventoExtra tipoEventoExtra) {
		this.tipoEventoExtra = tipoEventoExtra;
	}
	
	public boolean isActivo() {
		return activo;
	}

	public void setActivo(boolean activo) {
		this.activo = activo;
	}

	public Integer getUsuarioId() {
		return usuarioId;
	}

	public void setUsuarioId(Integer usuarioId) {
		this.usuarioId = usuarioId;
	}

	public Date getFecmodif() {
		return fecmodif;
	}

	public void setFecmodif(Date fecmodif) {
		this.fecmodif = fecmodif;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((comemptipoeventoextraId == null) ? 0 : comemptipoeventoextraId.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		ComEmpTipoEventoExtra other = (ComEmpTipoEventoExtra) obj;
		if (comemptipoeventoextraId == null) {
			if (other.comemptipoeventoextraId != null)
				return false;
		} else if (!comemptipoeventoextraId.equals(other.comemptipoeventoextraId))
			return false;
		return true;
	}
}
