/*
 * 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 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 = "pago_extra")
@XmlRootElement
@NamedQueries({
        @NamedQuery(name = "PagoExtra.findAll", query = "SELECT p FROM PagoExtra p"),
        @NamedQuery(name = "PagoExtra.findByConsultorCodigo", query = "SELECT p FROM PagoExtra p WHERE p.pagoExtraPK.consultorCodigo = :consultorCodigo"),
        @NamedQuery(name = "PagoExtra.findByAbonoCodigo", query = "SELECT p FROM PagoExtra p WHERE p.pagoExtraPK.abonoCodigo = :abonoCodigo"),
        @NamedQuery(name = "PagoExtra.findByDocumentoCodigo", query = "SELECT p FROM PagoExtra p WHERE p.documentoCodigo = :documentoCodigo"),
        @NamedQuery(name = "PagoExtra.findByPagoExtraFecha", query = "SELECT p FROM PagoExtra p WHERE p.pagoExtraFecha = :pagoExtraFecha"),
        @NamedQuery(name = "PagoExtra.findByPagoExtraValor", query = "SELECT p FROM PagoExtra p WHERE p.pagoExtraValor = :pagoExtraValor"),
        @NamedQuery(name = "PagoExtra.findByAbonoTipo", query = "SELECT p FROM PagoExtra p WHERE p.pagoExtraPK.abonoTipo = :abonoTipo")})
public class PagoExtra implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected PagoExtraPK pagoExtraPK;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 2)
    @Column(name = "documento_codigo")
    private String documentoCodigo;
    @Basic(optional = false)
    @NotNull
    @Column(name = "pago_extra_fecha")
    @Temporal(TemporalType.DATE)
    private Date pagoExtraFecha;
    // @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 = "pago_extra_valor")
    private BigDecimal pagoExtraValor;
    // @JoinColumn(name = "abono_codigo", referencedColumnName = "abono_codigo", insertable = false, updatable = false)

    public PagoExtra() {
    }

    public PagoExtra(PagoExtraPK pagoExtraPK) {
        this.pagoExtraPK = pagoExtraPK;
    }

    public PagoExtra(PagoExtraPK pagoExtraPK, String documentoCodigo, Date pagoExtraFecha, BigDecimal pagoExtraValor) {
        this.pagoExtraPK = pagoExtraPK;
        this.documentoCodigo = documentoCodigo;
        this.pagoExtraFecha = pagoExtraFecha;
        this.pagoExtraValor = pagoExtraValor;
    }

    public PagoExtra(String consultorCodigo, String abonoCodigo, String abonoTipo) {
        this.pagoExtraPK = new PagoExtraPK(consultorCodigo, abonoCodigo, abonoTipo);
    }

    public PagoExtraPK getPagoExtraPK() {
        return pagoExtraPK;
    }

    public void setPagoExtraPK(PagoExtraPK pagoExtraPK) {
        this.pagoExtraPK = pagoExtraPK;
    }

    public String getDocumentoCodigo() {
        return documentoCodigo;
    }

    public void setDocumentoCodigo(String documentoCodigo) {
        this.documentoCodigo = documentoCodigo;
    }

    public Date getPagoExtraFecha() {
        return pagoExtraFecha;
    }

    public void setPagoExtraFecha(Date pagoExtraFecha) {
        this.pagoExtraFecha = pagoExtraFecha;
    }

    public BigDecimal getPagoExtraValor() {
        return pagoExtraValor;
    }

    public void setPagoExtraValor(BigDecimal pagoExtraValor) {
        this.pagoExtraValor = pagoExtraValor;
    }

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

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

}
