/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cosmodas.EntCosmos;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 * @author obper
 */
@Entity
@Table(name = "cola_consultor")
@XmlRootElement
@NamedQueries({
        @NamedQuery(name = "ColaConsultor.findAll", query = "SELECT c FROM ColaConsultor c"),
        @NamedQuery(name = "ColaConsultor.findByConsultorCodigo", query = "SELECT c FROM ColaConsultor c WHERE c.colaConsultorPK.consultorCodigo = :consultorCodigo"),
        @NamedQuery(name = "ColaConsultor.findByConsultorNombre", query = "SELECT c FROM ColaConsultor c WHERE c.consultorNombre = :consultorNombre"),
        @NamedQuery(name = "ColaConsultor.findByHora", query = "SELECT c FROM ColaConsultor c WHERE c.hora = :hora"),
        @NamedQuery(name = "ColaConsultor.findByDespacho", query = "SELECT c FROM ColaConsultor c WHERE c.despacho = :despacho"),
        @NamedQuery(name = "ColaConsultor.findByIdn", query = "SELECT c FROM ColaConsultor c WHERE c.colaConsultorPK.idn = :idn"),
        @NamedQuery(name = "ColaConsultor.findByLlamada", query = "SELECT c FROM ColaConsultor c WHERE c.llamada = :llamada")})
public class ColaConsultor implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected ColaConsultorPK colaConsultorPK;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "consultor_nombre")
    private String consultorNombre;
    @Basic(optional = false)
    @NotNull
    @Column(name = "hora")
    @Temporal(TemporalType.TIMESTAMP)
    private Date hora;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 15)
    @Column(name = "despacho")
    private String despacho;
    @Basic(optional = false)
    @NotNull
    @Column(name = "llamada")
    private int llamada;

    public ColaConsultor() {
    }

    public ColaConsultor(ColaConsultorPK colaConsultorPK) {
        this.colaConsultorPK = colaConsultorPK;
    }

    public ColaConsultor(ColaConsultorPK colaConsultorPK, String consultorNombre, Date hora, String despacho, int llamada) {
        this.colaConsultorPK = colaConsultorPK;
        this.consultorNombre = consultorNombre;
        this.hora = hora;
        this.despacho = despacho;
        this.llamada = llamada;
    }

    public ColaConsultor(String consultorCodigo, int idn) {
        this.colaConsultorPK = new ColaConsultorPK(consultorCodigo, idn);
    }

    public ColaConsultorPK getColaConsultorPK() {
        return colaConsultorPK;
    }

    public void setColaConsultorPK(ColaConsultorPK colaConsultorPK) {
        this.colaConsultorPK = colaConsultorPK;
    }

    public String getConsultorNombre() {
        return consultorNombre;
    }

    public void setConsultorNombre(String consultorNombre) {
        this.consultorNombre = consultorNombre;
    }

    public Date getHora() {
        return hora;
    }

    public void setHora(Date hora) {
        this.hora = hora;
    }

    public String getDespacho() {
        return despacho;
    }

    public void setDespacho(String despacho) {
        this.despacho = despacho;
    }

    public int getLlamada() {
        return llamada;
    }

    public void setLlamada(int llamada) {
        this.llamada = llamada;
    }

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

    @Override
    public String toString() {
        return "com.cosmodas.dbcon.ColaConsultor[ colaConsultorPK=" + colaConsultorPK + " ]";
    }

}
