/*
 * 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 = "take_number")
@XmlRootElement
@NamedQueries({
        @NamedQuery(name = "TakeNumber.findAll", query = "SELECT t FROM TakeNumber t"),
        @NamedQuery(name = "TakeNumber.findByConsultorCodigo", query = "SELECT t FROM TakeNumber t WHERE t.takeNumberPK.consultorCodigo = :consultorCodigo"),
        @NamedQuery(name = "TakeNumber.findByConsultorNombre", query = "SELECT t FROM TakeNumber t WHERE t.consultorNombre = :consultorNombre"),
        @NamedQuery(name = "TakeNumber.findByHora", query = "SELECT t FROM TakeNumber t WHERE t.hora = :hora"),
        @NamedQuery(name = "TakeNumber.findByDespacho", query = "SELECT t FROM TakeNumber t WHERE t.despacho = :despacho"),
        @NamedQuery(name = "TakeNumber.findByIdn", query = "SELECT t FROM TakeNumber t WHERE t.takeNumberPK.idn = :idn"),
        @NamedQuery(name = "TakeNumber.findByLlamada", query = "SELECT t FROM TakeNumber t WHERE t.llamada = :llamada")})
public class TakeNumber implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TakeNumberPK takeNumberPK;
    @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 TakeNumber() {
    }

    public TakeNumber(TakeNumberPK takeNumberPK) {
        this.takeNumberPK = takeNumberPK;
    }

    public TakeNumber(TakeNumberPK takeNumberPK, String consultorNombre, Date hora, String despacho, int llamada) {
        this.takeNumberPK = takeNumberPK;
        this.consultorNombre = consultorNombre;
        this.hora = hora;
        this.despacho = despacho;
        this.llamada = llamada;
    }

    public TakeNumber(String consultorCodigo, int idn) {
        this.takeNumberPK = new TakeNumberPK(consultorCodigo, idn);
    }

    public TakeNumberPK getTakeNumberPK() {
        return takeNumberPK;
    }

    public void setTakeNumberPK(TakeNumberPK takeNumberPK) {
        this.takeNumberPK = takeNumberPK;
    }

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

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

}
