/*
 * 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.Embeddable;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * @author obper
 */
@Embeddable
public class WcDetalleRequisicionProductoPK implements Serializable {

    @Basic(optional = false)
    @NotNull
    @Column(name = "id_req")
    private int idReq;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 5)
    @Column(name = "producto_codigo")
    private String productoCodigo;

    public WcDetalleRequisicionProductoPK() {
    }

    public WcDetalleRequisicionProductoPK(int idReq, String productoCodigo) {
        this.idReq = idReq;
        this.productoCodigo = productoCodigo;
    }

    public int getIdReq() {
        return idReq;
    }

    public void setIdReq(int idReq) {
        this.idReq = idReq;
    }

    public String getProductoCodigo() {
        return productoCodigo;
    }

    public void setProductoCodigo(String productoCodigo) {
        this.productoCodigo = productoCodigo;
    }

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

    @Override
    public String toString() {
        return "com.cosmodas.dbcon.WcDetalleRequisicionProductoPK[ idReq=" + idReq + ", productoCodigo=" + productoCodigo + " ]";
    }

}
