/*
 * 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 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.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 * @author obper
 */
@Entity
@Table(name = "detalle_premio")
@XmlRootElement
@NamedQueries({
        @NamedQuery(name = "DetallePremio.findAll", query = "SELECT d FROM DetallePremio d"),
        @NamedQuery(name = "DetallePremio.findByPremioCodigo", query = "SELECT d FROM DetallePremio d WHERE d.detallePremioPK.premioCodigo = :premioCodigo"),
        @NamedQuery(name = "DetallePremio.findByArticuloCodigo", query = "SELECT d FROM DetallePremio d WHERE d.detallePremioPK.articuloCodigo = :articuloCodigo"),
        @NamedQuery(name = "DetallePremio.findByDetallePremioCantidad", query = "SELECT d FROM DetallePremio d WHERE d.detallePremioCantidad = :detallePremioCantidad"),
        @NamedQuery(name = "DetallePremio.findByDetalleEnvio", query = "SELECT d FROM DetallePremio d WHERE d.detalleEnvio = :detalleEnvio")})
public class DetallePremio implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected DetallePremioPK detallePremioPK;
    @Basic(optional = false)
    @NotNull
    @Column(name = "detalle_premio_cantidad")
    private short detallePremioCantidad;
    @Column(name = "detalle_envio")
    private Character detalleEnvio;

    public DetallePremio() {
    }

    public DetallePremio(DetallePremioPK detallePremioPK) {
        this.detallePremioPK = detallePremioPK;
    }

    public DetallePremio(DetallePremioPK detallePremioPK, short detallePremioCantidad) {
        this.detallePremioPK = detallePremioPK;
        this.detallePremioCantidad = detallePremioCantidad;
    }

    public DetallePremio(String premioCodigo, String articuloCodigo) {
        this.detallePremioPK = new DetallePremioPK(premioCodigo, articuloCodigo);
    }

    public DetallePremioPK getDetallePremioPK() {
        return detallePremioPK;
    }

    public void setDetallePremioPK(DetallePremioPK detallePremioPK) {
        this.detallePremioPK = detallePremioPK;
    }

    public short getDetallePremioCantidad() {
        return detallePremioCantidad;
    }

    public void setDetallePremioCantidad(short detallePremioCantidad) {
        this.detallePremioCantidad = detallePremioCantidad;
    }

    public Character getDetalleEnvio() {
        return detalleEnvio;
    }

    public void setDetalleEnvio(Character detalleEnvio) {
        this.detalleEnvio = detalleEnvio;
    }

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

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

}
