/*
 * 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 ArticuloSalaPK implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 4)
    @Column(name = "articulo_codigo")
    private String articuloCodigo;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 2)
    @Column(name = "sucursal_codigo")
    private String sucursalCodigo;

    public ArticuloSalaPK() {
    }

    public ArticuloSalaPK(String articuloCodigo, String sucursalCodigo) {
        this.articuloCodigo = articuloCodigo;
        this.sucursalCodigo = sucursalCodigo;
    }

    public String getArticuloCodigo() {
        return articuloCodigo;
    }

    public void setArticuloCodigo(String articuloCodigo) {
        this.articuloCodigo = articuloCodigo;
    }

    public String getSucursalCodigo() {
        return sucursalCodigo;
    }

    public void setSucursalCodigo(String sucursalCodigo) {
        this.sucursalCodigo = sucursalCodigo;
    }

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

    @Override
    public String toString() {
        return "com.cosmodas.dbcon.ArticuloSalaPK[ articuloCodigo=" + articuloCodigo + ", sucursalCodigo=" + sucursalCodigo + " ]";
    }

}
