package com.rjconsultores.ventaboletos.entidad;

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

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Parameter;
import org.hibernate.annotations.Type;

import com.rjconsultores.ventaboletos.enums.EnumLinguagemImpresion;

@Entity
@SequenceGenerator(name = "IMPRESION_LAYOUT_CONFIG_SEQ", sequenceName = "IMPRESION_LAYOUT_CONFIG_SEQ", allocationSize = 1)
@Table(name = "IMPRESION_LAYOUT_CONFIG")
public class ImpresionLayoutConfig implements Serializable {

	private static final long serialVersionUID = 1L;
	@Id
	@Basic(optional = false)
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "IMPRESION_LAYOUT_CONFIG_SEQ")
	@Column(name = "IMPRESIONLAYOUTCONFIG_ID")
	private Integer impresionLayoutConfigId;
	@Column(name = "DESCRICAO")
	private String descricao;
	@Column(name = "TEXTO")
	private String texto;
	@Type(type = "com.rjconsultores.ventaboletos.constantes.CustomEnumTypeHibernate", parameters = {
			@Parameter(name = "type", value = "com.rjconsultores.ventaboletos.constantes.CustomEnumTypeHibernate"),
			@Parameter(name = "class", value = "com.rjconsultores.ventaboletos.enums.EnumLinguagemImpresion"),
			@Parameter(name = "sqlType", value = "4")/* Types.INTEGER */,
			@Parameter(name = "enumName", value = "false"), @Parameter(name = "enumMethod", value = "getLinguagemImpresionByValor") })
	@Column(name = "LINGUAGEM")
	private EnumLinguagemImpresion linguagem;
	@Column(name = "ACTIVO")
	private Boolean activo;
	@Column(name = "FECMODIF")
	@Temporal(TemporalType.TIMESTAMP)
	private Date fecmodif;
	@Column(name = "USUARIO_ID")
	private Integer usuarioId;

	public ImpresionLayoutConfig() {
	}

	public Integer getImpresionLayoutConfigId() {
		return impresionLayoutConfigId;
	}

	public void setImpresionLayoutConfigId(Integer impresionLayoutConfigId) {
		this.impresionLayoutConfigId = impresionLayoutConfigId;
	}

	public String getDescricao() {
		return descricao;
	}

	public void setDescricao(String descricao) {
		this.descricao = descricao;
	}

	public String getTexto() {
		return texto;
	}

	public void setTexto(String texto) {
		this.texto = texto;
	}

	public EnumLinguagemImpresion getLinguagem() {
		return linguagem;
	}

	public void setLinguagem(EnumLinguagemImpresion linguagem) {
		this.linguagem = linguagem;
	}

	public Boolean getActivo() {
		return activo;
	}

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

	public Date getFecmodif() {
		return fecmodif;
	}

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

	public Integer getUsuarioId() {
		return usuarioId;
	}

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

	@Override
	public int hashCode() {
		int hash = 0;
		hash += (impresionLayoutConfigId != null ? impresionLayoutConfigId.hashCode() : 0);
		return hash;
	}

	@Override
	public boolean equals(Object object) {
		if (!(object instanceof ImpresionLayoutConfig)) {
			return false;
		}
		ImpresionLayoutConfig other = (ImpresionLayoutConfig) object;
		if ((this.impresionLayoutConfigId == null && other.impresionLayoutConfigId != null)
				|| (this.impresionLayoutConfigId != null
						&& !this.impresionLayoutConfigId.equals(other.impresionLayoutConfigId))) {
			return false;
		}
		return true;
	}

	@Override
	public String toString() {
		if (getDescricao() != null || getImpresionLayoutConfigId() != null) {
			return this.getDescricao() + " - " + this.getLinguagem();
		}
		return getDescricao();
	}

}
