/*
 * 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 FacturasPK implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 2)
    @Column(name = "factura_serie")
    private String facturaSerie;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 6)
    @Column(name = "factura_codigo")
    private String facturaCodigo;

    public FacturasPK() {
    }

    public FacturasPK(String facturaSerie, String facturaCodigo) {
        this.facturaSerie = facturaSerie;
        this.facturaCodigo = facturaCodigo;
    }

    public String getFacturaSerie() {
        return facturaSerie;
    }

    public void setFacturaSerie(String facturaSerie) {
        this.facturaSerie = facturaSerie;
    }

    public String getFacturaCodigo() {
        return facturaCodigo;
    }

    public void setFacturaCodigo(String facturaCodigo) {
        this.facturaCodigo = facturaCodigo;
    }

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

    @Override
    public String toString() {
        return "com.cosmodas.dbcon.FacturasPK[ facturaSerie=" + facturaSerie + ", facturaCodigo=" + facturaCodigo + " ]";
    }

}
