/*
 * 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.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 * @author obper
 */
@Entity
@Table(name = "programas")
@XmlRootElement
@NamedQueries({
        @NamedQuery(name = "Programas.findAll", query = "SELECT p FROM Programas p"),
        @NamedQuery(name = "Programas.findByProgramaCodigo", query = "SELECT p FROM Programas p WHERE p.programaCodigo = :programaCodigo"),
        @NamedQuery(name = "Programas.findByProgramaNombre", query = "SELECT p FROM Programas p WHERE p.programaNombre = :programaNombre"),
        @NamedQuery(name = "Programas.findByProgramaMensaje", query = "SELECT p FROM Programas p WHERE p.programaMensaje = :programaMensaje"),
        @NamedQuery(name = "Programas.findByProgramaLlave", query = "SELECT p FROM Programas p WHERE p.programaLlave = :programaLlave"),
        @NamedQuery(name = "Programas.findByProgramaCorrelativo", query = "SELECT p FROM Programas p WHERE p.programaCorrelativo = :programaCorrelativo"),
        @NamedQuery(name = "Programas.findByProgramaEnvio", query = "SELECT p FROM Programas p WHERE p.programaEnvio = :programaEnvio")})
public class Programas implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 3)
    @Column(name = "programa_codigo")
    private String programaCodigo;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "programa_nombre")
    private String programaNombre;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "programa_mensaje")
    private String programaMensaje;
    @Basic(optional = false)
    @NotNull
    @Column(name = "programa_llave")
    private boolean programaLlave;
    @Basic(optional = false)
    @NotNull
    @Column(name = "programa_correlativo")
    private short programaCorrelativo;
    @Basic(optional = false)
    @NotNull
    @Column(name = "programa_envio")
    private boolean programaEnvio;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "programas")
    private Collection<Precioprograma> precioprogramaCollection;

    public Programas() {
    }

    public Programas(String programaCodigo) {
        this.programaCodigo = programaCodigo;
    }

    public Programas(String programaCodigo, String programaNombre, String programaMensaje, boolean programaLlave, short programaCorrelativo, boolean programaEnvio) {
        this.programaCodigo = programaCodigo;
        this.programaNombre = programaNombre;
        this.programaMensaje = programaMensaje;
        this.programaLlave = programaLlave;
        this.programaCorrelativo = programaCorrelativo;
        this.programaEnvio = programaEnvio;
    }

    public String getProgramaCodigo() {
        return programaCodigo;
    }

    public void setProgramaCodigo(String programaCodigo) {
        this.programaCodigo = programaCodigo;
    }

    public String getProgramaNombre() {
        return programaNombre;
    }

    public void setProgramaNombre(String programaNombre) {
        this.programaNombre = programaNombre;
    }

    public String getProgramaMensaje() {
        return programaMensaje;
    }

    public void setProgramaMensaje(String programaMensaje) {
        this.programaMensaje = programaMensaje;
    }

    public boolean getProgramaLlave() {
        return programaLlave;
    }

    public void setProgramaLlave(boolean programaLlave) {
        this.programaLlave = programaLlave;
    }

    public short getProgramaCorrelativo() {
        return programaCorrelativo;
    }

    public void setProgramaCorrelativo(short programaCorrelativo) {
        this.programaCorrelativo = programaCorrelativo;
    }

    public boolean getProgramaEnvio() {
        return programaEnvio;
    }

    public void setProgramaEnvio(boolean programaEnvio) {
        this.programaEnvio = programaEnvio;
    }

    @XmlTransient
    public Collection<Precioprograma> getPrecioprogramaCollection() {
        return precioprogramaCollection;
    }

    public void setPrecioprogramaCollection(Collection<Precioprograma> precioprogramaCollection) {
        this.precioprogramaCollection = precioprogramaCollection;
    }

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

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

}
