/*
 * 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.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 * @author obper
 */
@Entity
@Table(name = "precioprograma")
@XmlRootElement
@NamedQueries({
        @NamedQuery(name = "Precioprograma.findAll", query = "SELECT p FROM Precioprograma p"),
        @NamedQuery(name = "Precioprograma.findProc", query = "SELECT p.precioprogramaPK.ofertaCodigo FROM Precioprograma p WHERE p.precioprogramaPK.productoCodigo = :productoCodigo AND p.precioprogramaPK.programaCodigo = :programaCodigo "),
        @NamedQuery(name = "Precioprograma.findProc2", query = "SELECT p FROM Precioprograma p WHERE p.precioprogramaPK.productoCodigo = :productoCodigo AND p.precioprogramaPK.programaCodigo = :programaCodigo "),
        @NamedQuery(name = "Precioprograma.findByProgramaCodigo", query = "SELECT p FROM Precioprograma p WHERE p.precioprogramaPK.programaCodigo = :programaCodigo"),
        @NamedQuery(name = "Precioprograma.findByProductoCodigo", query = "SELECT p FROM Precioprograma p WHERE p.precioprogramaPK.productoCodigo = :productoCodigo"),
        @NamedQuery(name = "Precioprograma.findByPrecioProgramaOferta", query = "SELECT p FROM Precioprograma p WHERE p.precioProgramaOferta = :precioProgramaOferta"),
        @NamedQuery(name = "Precioprograma.findByOfertaCodigo", query = "SELECT p FROM Precioprograma p WHERE p.precioprogramaPK.ofertaCodigo = :ofertaCodigo"),
        @NamedQuery(name = "Precioprograma.findByPrecioProgramaDoblePromocion", query = "SELECT p FROM Precioprograma p WHERE p.precioProgramaDoblePromocion = :precioProgramaDoblePromocion"),
        @NamedQuery(name = "Precioprograma.findByPrecioProgramaCatalogo", query = "SELECT p FROM Precioprograma p WHERE p.precioProgramaCatalogo = :precioProgramaCatalogo"),
        @NamedQuery(name = "Precioprograma.findByPrecioProgramaSinDescuento", query = "SELECT p FROM Precioprograma p WHERE p.precioProgramaSinDescuento = :precioProgramaSinDescuento"),
        @NamedQuery(name = "Precioprograma.findByPrecioProgramaConDescuento", query = "SELECT p FROM Precioprograma p WHERE p.precioProgramaConDescuento = :precioProgramaConDescuento"),
        @NamedQuery(name = "Precioprograma.findByDetalleEnvio", query = "SELECT p FROM Precioprograma p WHERE p.detalleEnvio = :detalleEnvio"),
        @NamedQuery(name = "Precioprograma.findByNumeroPromocion", query = "SELECT p FROM Precioprograma p WHERE p.numeroPromocion = :numeroPromocion"),
        @NamedQuery(name = "Precioprograma.findByTipoOferta", query = "SELECT p FROM Precioprograma p WHERE p.tipoOferta = :tipoOferta")})
public class Precioprograma implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected PrecioprogramaPK precioprogramaPK;
    @Basic(optional = false)
    @NotNull
    @Column(name = "precio_programa_oferta")
    private boolean precioProgramaOferta;
    @Basic(optional = false)
    @NotNull
    @Column(name = "precio_programa_doble_promocion")
    private boolean precioProgramaDoblePromocion;
    @Basic(optional = false)
    @NotNull
    @Column(name = "precio_programa_catalogo")
    private boolean precioProgramaCatalogo;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Basic(optional = false)
    @NotNull
    @Column(name = "precio_programa_sin_descuento")
    private BigDecimal precioProgramaSinDescuento;
    @Basic(optional = false)
    @NotNull
    @Column(name = "precio_programa_con_descuento")
    private BigDecimal precioProgramaConDescuento;
    @Column(name = "detalle_envio")
    private Character detalleEnvio;
    @Basic(optional = false)
    @NotNull
    @Column(name = "numero_promocion")
    private short numeroPromocion;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 3)
    @Column(name = "tipo_oferta")
    private String tipoOferta;
    @JoinColumn(name = "oferta_codigo", referencedColumnName = "oferta_codigo", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Ofertas ofertas;
    @JoinColumn(name = "programa_codigo", referencedColumnName = "programa_codigo", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Programas programas;

    public Precioprograma() {
    }

    public Precioprograma(PrecioprogramaPK precioprogramaPK) {
        this.precioprogramaPK = precioprogramaPK;
    }

    public Precioprograma(PrecioprogramaPK precioprogramaPK, boolean precioProgramaOferta, boolean precioProgramaDoblePromocion, boolean precioProgramaCatalogo, BigDecimal precioProgramaSinDescuento, BigDecimal precioProgramaConDescuento, short numeroPromocion, String tipoOferta) {
        this.precioprogramaPK = precioprogramaPK;
        this.precioProgramaOferta = precioProgramaOferta;
        this.precioProgramaDoblePromocion = precioProgramaDoblePromocion;
        this.precioProgramaCatalogo = precioProgramaCatalogo;
        this.precioProgramaSinDescuento = precioProgramaSinDescuento;
        this.precioProgramaConDescuento = precioProgramaConDescuento;
        this.numeroPromocion = numeroPromocion;
        this.tipoOferta = tipoOferta;
    }

    public Precioprograma(String programaCodigo, String productoCodigo, String ofertaCodigo) {
        this.precioprogramaPK = new PrecioprogramaPK(programaCodigo, productoCodigo, ofertaCodigo);
    }

    public PrecioprogramaPK getPrecioprogramaPK() {
        return precioprogramaPK;
    }

    public void setPrecioprogramaPK(PrecioprogramaPK precioprogramaPK) {
        this.precioprogramaPK = precioprogramaPK;
    }

    public boolean getPrecioProgramaOferta() {
        return precioProgramaOferta;
    }

    public void setPrecioProgramaOferta(boolean precioProgramaOferta) {
        this.precioProgramaOferta = precioProgramaOferta;
    }

    public boolean getPrecioProgramaDoblePromocion() {
        return precioProgramaDoblePromocion;
    }

    public void setPrecioProgramaDoblePromocion(boolean precioProgramaDoblePromocion) {
        this.precioProgramaDoblePromocion = precioProgramaDoblePromocion;
    }

    public boolean getPrecioProgramaCatalogo() {
        return precioProgramaCatalogo;
    }

    public void setPrecioProgramaCatalogo(boolean precioProgramaCatalogo) {
        this.precioProgramaCatalogo = precioProgramaCatalogo;
    }

    public BigDecimal getPrecioProgramaSinDescuento() {
        return precioProgramaSinDescuento;
    }

    public void setPrecioProgramaSinDescuento(BigDecimal precioProgramaSinDescuento) {
        this.precioProgramaSinDescuento = precioProgramaSinDescuento;
    }

    public BigDecimal getPrecioProgramaConDescuento() {
        return precioProgramaConDescuento;
    }

    public void setPrecioProgramaConDescuento(BigDecimal precioProgramaConDescuento) {
        this.precioProgramaConDescuento = precioProgramaConDescuento;
    }

    public Character getDetalleEnvio() {
        return detalleEnvio;
    }

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

    public short getNumeroPromocion() {
        return numeroPromocion;
    }

    public void setNumeroPromocion(short numeroPromocion) {
        this.numeroPromocion = numeroPromocion;
    }

    public String getTipoOferta() {
        return tipoOferta;
    }

    public void setTipoOferta(String tipoOferta) {
        this.tipoOferta = tipoOferta;
    }

    public Ofertas getOfertas() {
        return ofertas;
    }

    public void setOfertas(Ofertas ofertas) {
        this.ofertas = ofertas;
    }

    public Programas getProgramas() {
        return programas;
    }

    public void setProgramas(Programas programas) {
        this.programas = programas;
    }

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

    @Override
    public String toString() {
        return "dbCon.Precioprograma[ precioprogramaPK=" + precioprogramaPK + " ]";
    }

}
