/*
 * 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;

/**
 *
 * @author rodrigo
 */
@Entity
@SequenceGenerator(name = "MERCADO_COMPETIDO_SEQ", sequenceName = "MERCADO_COMPETIDO_SEQ", allocationSize = 1)
@Table(name = "MERCADO_COMPETIDO")
public class MercadoCompetido implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "MERCADO_COMPETIDO_SEQ")
    @Basic(optional = false)
    @Column(name = "MERCADOCOMPETIDO_ID")
    private Integer mercadocompetidoId;
    @Column(name = "ACTIVO")
    private Boolean activo;
    @Column(name = "FECMODIF")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecmodif;
    @Column(name = "USUARIO_ID")
    private Integer usuarioId;
    @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID")
    @ManyToOne
    private Parada origem;
    @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID")
    @ManyToOne
    private Parada destino;
    @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID")
    @ManyToOne
    private ClaseServicio claseServicio;

    public MercadoCompetido() {
    }

    public Boolean getActivo() {
        return activo;
    }

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

    public ClaseServicio getClaseServicio() {
        return claseServicio;
    }

    public void setClaseServicio(ClaseServicio claseServicio) {
        this.claseServicio = claseServicio;
    }

    public Parada getDestino() {
        return destino;
    }

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

    public Date getFecmodif() {
        return fecmodif;
    }

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

    public Integer getMercadocompetidoId() {
        return mercadocompetidoId;
    }

    public void setMercadocompetidoId(Integer mercadocompetidoId) {
        this.mercadocompetidoId = mercadocompetidoId;
    }

    public Parada getOrigem() {
        return origem;
    }

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

    public Integer getUsuarioId() {
        return usuarioId;
    }

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

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

    @Override
    public String toString() {
        return "newpackage.MercadoCompetido[mercadocompetidoId=" + mercadocompetidoId + "]";
    }
}
