package com.rjconsultores.ventaboletos.entidad;

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

@Entity
@Table(name = "TIPO_EVENTO_EXTRA_PTOVTA")
@SequenceGenerator(name = "TIPOEVENTOEXTRAPTOVTA_SEQ", sequenceName = "TIPOEVENTOEXTRAPTOVTA_SEQ", allocationSize = 1)
public class TipoEventoExtraPtoVta {
	@Id
    @Basic(optional = false)
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPOEVENTOEXTRAPTOVTA_SEQ")
    @Column(name = "TIPOEVENTOEXTRAPTOVTA_ID")
	private Integer tipoeventoextraptovtaId;	
	@ManyToOne
	@JoinColumn(name = "TIPOEVENTOEXTRA_ID")
	private TipoEventoExtra tipoeventoextra;
	@ManyToOne
	@JoinColumn(name = "PUNTOVENTA_ID")	
	private PuntoVenta puntoventa;
	@Column(name = "USUARIO_ID")
	private Integer usuarioId;
	@Column(name = "FECMODIF")
	@Temporal(TemporalType.TIMESTAMP)
	private Date fecmodif;
	@Column(name = "ACTIVO")
	private Boolean activo;
	
	public Integer getTipoeventoextraptovtaId() {
		return tipoeventoextraptovtaId;
	}
	public void setTipoeventoextraptovtaId(Integer tipoeventoextraptovtaId) {
		this.tipoeventoextraptovtaId = tipoeventoextraptovtaId;
	}
	public TipoEventoExtra getTipoeventoextra() {
		return tipoeventoextra;
	}
	public void setTipoeventoextra(TipoEventoExtra tipoeventoextra) {
		this.tipoeventoextra = tipoeventoextra;
	}
	public PuntoVenta getPuntoventa() {
		return puntoventa;
	}
	public void setPuntoventa(PuntoVenta puntoventa) {
		this.puntoventa = puntoventa;
	}
	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;
	}
	public Boolean getActivo() {
		return activo;
	}
	public void setActivo(Boolean activo) {
		this.activo = activo;
	}
	
	@Override
	public String toString(){
		return this.puntoventa.getNombpuntoventa();
	}
	
	@Override
    public int hashCode() {
        int hash = 0;
        hash += (tipoeventoextraptovtaId != null ? tipoeventoextraptovtaId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoEventoExtraPtoVta)) {
            return false;
        }
        TipoEventoExtraPtoVta other = (TipoEventoExtraPtoVta) object;
        if ((this.tipoeventoextraptovtaId == null && other.tipoeventoextraptovtaId != null) || (this.tipoeventoextraptovtaId != null && !this.tipoeventoextraptovtaId.equals(other.tipoeventoextraptovtaId))) {
            return false;
        }
        return true;
    }
}
