/*
 * 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 CreditoFiscalPK implements Serializable {

    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 6)
    @Column(name = "factura_codigo")
    private String facturaCodigo;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 2)
    @Column(name = "serie")
    private String serie;

    public CreditoFiscalPK() {
    }

    public CreditoFiscalPK(String facturaCodigo, String serie) {
        this.facturaCodigo = facturaCodigo;
        this.serie = serie;
    }

    public String getFacturaCodigo() {
        return facturaCodigo;
    }

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

    public String getSerie() {
        return serie;
    }

    public void setSerie(String serie) {
        this.serie = serie;
    }

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

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

}
