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

/**
 *
 * @author Administrador
 */
@Entity
@SequenceGenerator(name = "VIA_SEQ", sequenceName = "VIA_SEQ", allocationSize = 1)
@Table(name = "VIA")
public class Via implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "VIA_SEQ")
    @Basic(optional = false)
    @Column(name = "VIA_ID")
    private Integer viaId;
    @Column(name = "NOMBVIA")
    private String nombvia;
    @Column(name = "ACTIVO")
    private Boolean activo;
    @Column(name = "FECMODIF")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecmodif;
    @Column(name = "USUARIO_ID")
    private Integer usuarioId;
    @OneToMany(mappedBy = "via")
    private List<Tramo> tramoList;

    public Via() {
    }

    public Via(Integer viaId) {
        this.viaId = viaId;
    }

    public Integer getViaId() {
        return viaId;
    }

    public void setViaId(Integer viaId) {
        this.viaId = viaId;
    }

    public String getNombvia() {
        return nombvia;
    }

    public void setNombvia(String nombvia) {
        this.nombvia = nombvia;
    }

    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 List<Tramo> getTramoList() {
        return tramoList;
    }

    public void setTramoList(List<Tramo> tramoList) {
        this.tramoList = tramoList;
    }

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

    @Override
    public String toString() {
        return getNombvia();
    }
}
