/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
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.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.apache.commons.lang.BooleanUtils;

/**
 *
 * @author Rafius
 */
@Entity
@SequenceGenerator(name = "RUTA_COMBINACION_SEQ", sequenceName = "RUTA_COMBINACION_SEQ", allocationSize=1)
@Table(name = "RUTA_COMBINACION")
public class RutaCombinacion implements Serializable, Cloneable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "RUTA_COMBINACION_SEQ")
    @Column(name = "RUTACOMBINACION_ID")
    private Integer rutacombinacionId;
    
    @Column(name = "INDVENTA")
    private Boolean indventa;
    
    @Column(name = "ACTIVO")
    private Boolean activo;
    
    @Column(name = "FECMODIF")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecmodif;
    
    @Column(name = "USUARIO_ID")
    private Integer usuarioId;
    
    @JoinColumn(name = "TRAMO_ID", referencedColumnName = "TRAMO_ID")
    @ManyToOne
    private Tramo tramo;
    
    @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID")
    @ManyToOne
    private Ruta ruta;
    
    @Column(name = "INDUSAPRICING")
    private Boolean indUsaPricing;
    
    @Column(name = "CODIGODERPR")
    private String codigoDerPr;
    
    @Column(name = "INDEXIBETABELA")
    private Boolean indExibeTabela;
    
    @JoinColumn(name = "ALIASRUTA_ID", referencedColumnName = "RUTA_ID")
    @ManyToOne
    private Ruta aliasRuta;

    public RutaCombinacion() {
    }

    @Override
    public Object clone() throws CloneNotSupportedException {
    	return super.clone();
    }
    
    
    public RutaCombinacion(Integer rutacombinacionId) {
        this.rutacombinacionId = rutacombinacionId;
    }

    public Integer getRutacombinacionId() {
        return rutacombinacionId;
    }

    public void setRutacombinacionId(Integer rutacombinacionId) {
        this.rutacombinacionId = rutacombinacionId;
    }

    public Boolean getIndventa() {
        return BooleanUtils.toBooleanDefaultIfNull(indventa, Boolean.TRUE);
    }

    public void setIndventa(Boolean indventa) {
        this.indventa = indventa;
    }

    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 Tramo getTramo() {
        return tramo;
    }

    public void setTramo(Tramo tramo) {
        this.tramo = tramo;
    }

    public Ruta getRuta() {
        return ruta;
    }

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

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (rutacombinacionId != null ? rutacombinacionId.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 RutaCombinacion)) {
            return false;
        }
        RutaCombinacion other = (RutaCombinacion) object;
        if ((this.rutacombinacionId == null && other.rutacombinacionId != null) || (this.rutacombinacionId != null && !this.rutacombinacionId.equals(other.rutacombinacionId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.rjconsultores.ventaboletos.entidad.RutaCombinacion[rutacombinacionId=" + rutacombinacionId + "]";
    }

	public Boolean getIndUsaPricing() {
		return BooleanUtils.toBooleanDefaultIfNull(indUsaPricing, Boolean.TRUE);
	}

	public void setIndUsaPricing(Boolean indUsaPricing) {
		this.indUsaPricing = indUsaPricing;
	}
	
	public String getCodigoDerPr() {
		return codigoDerPr;
	}

	public void setCodigoDerPr(String codigoDerPr) {
		this.codigoDerPr = codigoDerPr;
	}

	public boolean isIndExibeTabela() {
		return Boolean.TRUE.equals(indExibeTabela);
	}

	public void setIndExibeTabela(Boolean indExibeTabela) {
		this.indExibeTabela = indExibeTabela;
	}

	public Ruta getAliasRuta() {
		return aliasRuta;
	}

	public void setAliasRuta(Ruta aliasRuta) {
		this.aliasRuta = aliasRuta;
	}
}
