/*
 * 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.math.BigDecimal;
import java.util.Date;
import java.util.List;

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

import org.hibernate.annotations.Where;

/**
 *
 * @author rodrigo
 */
@Entity
@SequenceGenerator(name = "TARIFA_MINIMA_SEQ", sequenceName = "TARIFA_MINIMA_SEQ", allocationSize = 1)
@Table(name = "TARIFA_MINIMA")
public class TarifaMinima implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "TARIFA_MINIMA_SEQ")
    @Column(name = "TARIFAMINIMA_ID")
    private Integer tarifaminimaId;
    @Column(name = "IMPORTETARIFA")
    private BigDecimal importetarifa;
    @OneToOne
    @JoinColumn(name = "PLAZA_ID")
    private Plaza plaza;
    @OneToOne
    @JoinColumn(name = "CLASESERVICIO_ID")
    private ClaseServicio claseServicio;
    @OneToOne
    @JoinColumn(name = "ORGAOCONCEDENTE_ID")
    private OrgaoConcedente orgaoConcedente;
    @OneToOne
    @JoinColumn(name = "MARCA_ID")
    private Marca marca;
    @OneToOne
    @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID")
    private Parada origem;
    @OneToOne
    @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID")
    private Parada destino;
    @OneToOne
    @JoinColumn(name = "MONEDA_ID", referencedColumnName = "MONEDA_ID")
    private Moneda moneda;
    @Column(name = "ACTIVO")
    private Boolean activo;
    @Column(name = "FECMODIF")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecmodif;
    @Column(name = "USUARIO_ID")
    private Integer usuarioId;
    
    @OneToMany(mappedBy = "tarifaMinima")
    @Where(clause = "ACTIVO = 1")
    private List<TarifaMinimaCategoria> tarifaMinimaCategorias;
    
    @OneToOne
    @JoinColumn(name = "VIGENCIATARIFA_ID")
    private VigenciaTarifa vigenciaTarifa;
    
    @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID")
	@ManyToOne
	private Ruta ruta;
    
	@JoinColumn(name = "REGIONMETROPOLITANA_ID", referencedColumnName = "REGIONMETROPOLITANA_ID")
	@ManyToOne
	private RegionMetropolitana regionMetropolitana;
	
	@JoinColumn(name = "COEFICIENTETARIFA_ID", referencedColumnName = "COEFICIENTETARIFA_ID")
	@ManyToOne
	private CoeficienteTarifa coeficienteTarifa;

    public TarifaMinima() {
    }

    public TarifaMinima(Integer tarifaminimaId) {
        this.tarifaminimaId = tarifaminimaId;
    }

    public Moneda getMoneda() {
        return moneda;
    }

    public void setMoneda(Moneda moneda) {
        this.moneda = moneda;
    }

    public Integer getTarifaminimaId() {
        return tarifaminimaId;
    }

    public void setTarifaminimaId(Integer tarifaminimaId) {
        this.tarifaminimaId = tarifaminimaId;
    }

    public BigDecimal getImportetarifa() {
        return importetarifa;
    }

    public void setImportetarifa(BigDecimal importetarifa) {
        this.importetarifa = importetarifa;
    }

    public ClaseServicio getClaseServicio() {
        return claseServicio;
    }

    public void setClaseServicio(ClaseServicio claseServicio) {
        this.claseServicio = claseServicio;
    }
    
    public OrgaoConcedente getOrgaoConcedente() {
		return orgaoConcedente;
	}

	public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) {
		this.orgaoConcedente = orgaoConcedente;
	}

	public Parada getDestino() {
        return destino;
    }

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

    public Plaza getPlaza() {
        return plaza;
    }

    public void setPlaza(Plaza plaza) {
        this.plaza = plaza;
    }

    public Marca getMarca() {
        return marca;
    }

    public void setMarca(Marca marca) {
        this.marca = marca;
    }

    public Parada getOrigem() {
        return origem;
    }

    public void setOrigem(Parada origem) {
        this.origem = origem;
    }

    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 += (tarifaminimaId != null ? tarifaminimaId.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 TarifaMinima)) {
            return false;
        }
        TarifaMinima other = (TarifaMinima) object;
        if ((this.tarifaminimaId == null && other.tarifaminimaId != null) || (this.tarifaminimaId != null && !this.tarifaminimaId.equals(other.tarifaminimaId))) {
            return false;
        }
        return true;
    }

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

	public java.util.List<TarifaMinimaCategoria> getTarifaMinimaCategorias() {
		return tarifaMinimaCategorias;
	}

	public void setTarifaMinimaCategorias(java.util.List<TarifaMinimaCategoria> tarifaMinimaCategorias) {
		this.tarifaMinimaCategorias = tarifaMinimaCategorias;
	}

	public VigenciaTarifa getVigenciaTarifa() {
		return vigenciaTarifa;
	}

	public void setVigenciaTarifa(VigenciaTarifa vigenciaTarifa) {
		this.vigenciaTarifa = vigenciaTarifa;
	}

	public Ruta getRuta() {
		return ruta;
	}

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

	public RegionMetropolitana getRegionMetropolitana() {
		return regionMetropolitana;
	}

	public void setRegionMetropolitana(RegionMetropolitana regionMetropolitana) {
		this.regionMetropolitana = regionMetropolitana;
	}

	public CoeficienteTarifa getCoeficienteTarifa() {
		return coeficienteTarifa;
	}

	public void setCoeficienteTarifa(CoeficienteTarifa coeficienteTarifa) {
		this.coeficienteTarifa = coeficienteTarifa;
	}
}
