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

@Entity
@SequenceGenerator(name = "ALIAS_SERVICO_SEQ", sequenceName = "ALIAS_SERVICO_SEQ", allocationSize = 1)
@Table(name = "ALIAS_SERVICO")
public class AliasServico implements Serializable {

	private static final long serialVersionUID = 1L;
	@Id
	@Basic(optional = false)
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "ALIAS_SERVICO_SEQ")
	@Column(name = "ALIASSERVICO_ID")
	private Integer aliasServicoId;
	@OneToOne
	@JoinColumn(name = "ORIGEN_ID")
	private Parada origen;
	@OneToOne
	@JoinColumn(name = "DESTINO_ID")
	private Parada destino;
	@OneToOne
	@JoinColumn(name = "RUTA_ID")
	private Ruta ruta;
	@Column(name = "CORRIDA_ID")
	private Integer corridaId;
	@OneToOne
	@JoinColumn(name = "ALIASORIGEN_ID")
	private Parada aliasOrigen;
	@OneToOne
	@JoinColumn(name = "ALIASDESTINO_ID")
	private Parada aliasDestino;
	@Column(name = "ACTIVO")
	private Boolean activo;
	@Column(name = "FECMODIF")
	@Temporal(TemporalType.TIMESTAMP)
	private Date fecmodif;
	@Column(name = "USUARIO_ID")
	private Integer usuarioId;
	@Column(name = "INDIDALIASORIGINAL")
	private Boolean indIdAliasOriginal;
	
	public AliasServico() {
		super();
		this.indIdAliasOriginal = false;
	}

	public Integer getAliasServicoId() {
		return aliasServicoId;
	}

	public void setAliasServicoId(Integer aliasServicoId) {
		this.aliasServicoId = aliasServicoId;
	}

	public Parada getOrigen() {
		return origen;
	}

	public void setOrigen(Parada origen) {
		this.origen = origen;
	}

	public Parada getDestino() {
		return destino;
	}

	public void setDestino(Parada destino) {
		this.destino = destino;
	}

	public Ruta getRuta() {
		return ruta;
	}

	public void setRuta(Ruta ruta) {
		this.ruta = ruta;
	}

	public Integer getCorridaId() {
		return corridaId;
	}

	public void setCorridaId(Integer corridaId) {
		this.corridaId = corridaId;
	}

	public Parada getAliasOrigen() {
		return aliasOrigen;
	}

	public void setAliasOrigen(Parada aliasOrigen) {
		this.aliasOrigen = aliasOrigen;
	}

	public Parada getAliasDestino() {
		return aliasDestino;
	}

	public void setAliasDestino(Parada aliasDestino) {
		this.aliasDestino = aliasDestino;
	}

	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;
	}

	public Boolean getIndIdAliasOriginal() {
		return indIdAliasOriginal;
	}

	public void setIndIdAliasOriginal(Boolean indIdAliasOriginal) {
		this.indIdAliasOriginal = indIdAliasOriginal;
	}

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

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