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

/**
 *
 * @author Administrador
 */
@Entity
@SequenceGenerator(name = "CONDUCTOR_SEQ", sequenceName = "CONDUCTOR_SEQ", allocationSize = 1)
@Table(name = "CONDUCTOR")
public class Conductor implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "CONDUCTOR_ID")
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONDUCTOR_SEQ")
    private Integer conductorId;
    @Column(name = "NOMBCONDUCTOR")
    private String nombconductor;
    @Column(name = "ACTIVO")
    private Boolean activo;
    @Column(name = "FECMODIF")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecmodif;
    @Column(name = "USUARIO_ID")
    private Integer usuarioId;
    @OneToMany(mappedBy = "conductor")
    private List<Corrida> corridaList;
    @OneToMany(mappedBy = "conductor1")
    private List<Corrida> corridaList1;
    @OneToOne
    @JoinColumn(name = "EMPLEADO_ID")
    private Empleado empleado;
    @Column(name = "NOMBPATERNO")
    private String nomPaterno;
    @Column(name = "NOMBMATERNO")
    private String nomMaterno;
    
    public String getNomMaterno() {
		return nomMaterno;
	}

	public void setNomMaterno(String nomMaterno) {
		this.nomMaterno = nomMaterno;
	}

	public String getNomPaterno() {
        return nomPaterno;
    }

    public void setNomPaterno(String nomPaterno) {
        this.nomPaterno = nomPaterno;
    }

    public Empleado getEmpleado() {
        return empleado;
    }

    public void setEmpleado(Empleado empleado) {
        this.empleado = empleado;
    }

    public Conductor() {
    }

    public Conductor(Integer conductorId) {
        this.conductorId = conductorId;
    }

    public Integer getConductorId() {
        return conductorId;
    }

    public void setConductorId(Integer conductorId) {
        this.conductorId = conductorId;
    }

    public String getNombconductor() {
        return nombconductor;
    }

    public void setNombconductor(String nombconductor) {
        this.nombconductor = nombconductor;
    }

    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<Corrida> getCorridaList() {
        return corridaList;
    }

    public void setCorridaList(List<Corrida> corridaList) {
        this.corridaList = corridaList;
    }

    public List<Corrida> getCorridaList1() {
        return corridaList1;
    }

    public void setCorridaList1(List<Corrida> corridaList1) {
        this.corridaList1 = corridaList1;
    }

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

    @Override
    public String toString() {
        return (this.getEmpleado() != null ? this.getEmpleado().getCveEmpleado() : "") + "-" + this.getNombconductor() + " " + this.getNomPaterno();
    }
}
