package com.fp.persistence.pgeneral.product.rate;

import javax.persistence.Column;
import java.io.Serializable;
import java.math.BigDecimal;
import com.fp.dto.hb.HibernateId;
import java.lang.reflect.Field;
import javax.persistence.Embeddable;
import javax.persistence.Transient;

/**Clase que hace referencia a la Clave Primaria de TGENERATESGROUP*/
@Embeddable
public class TgeneRatesGroupKey  extends com.fp.dto.AbstractDataTransport  implements Serializable,Cloneable,HibernateId{
/**
* HashCode asociado con la Instancia
*/
@Transient
private int hashValue = 0;
/**
* Version de la Clase
*/
private static final long serialVersionUID = 1L;
@Column(name="INTERESTBALANCETYPE", nullable=false,updatable=false)

/**
* Código de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc
*/
private String interestbalancetype;

@Column(name="INTERESTBALANCEGROUP", nullable=false,updatable=false)

/**
* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor 
*/
private String interestbalancegroup;

@Column(name="RATECATALOG", nullable=false,updatable=false)

/**
* Codigo de catalogo  VIP, EMP empleado
*/
private String ratecatalog;

@Column(name="RATECATALOGCODE", nullable=false,updatable=false)

/**
* Codigo de tabla de catalogo de grupo de tasas RATES
*/
private String ratecatalogcode;

@Column(name="COMPANYCODE", nullable=false,updatable=false)

/**
* Codigo de compania
*/
private Integer companycode;

@Column(name="CURRENCYCODE", nullable=false,updatable=false)

/**
* Codigo de moneda
*/
private String currencycode;

@Column(name="MINTERM", nullable=false,updatable=false)

/**
* Plazo minnimo 
*/
private Integer minterm;

@Column(name="MINAMOUNT", nullable=false,updatable=false)

/**
* Monto minimo 
*/
private BigDecimal minamount;

/**Contructor por defecto*/
public TgeneRatesGroupKey(){}
/**Contructor de TgeneRatesGroupKey
@param pInterestbalancetype Código de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc
@param pInterestbalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor 
@param pRatecatalog Codigo de catalogo  VIP, EMP empleado
@param pRatecatalogcode Codigo de tabla de catalogo de grupo de tasas RATES
@param pCompanycode Codigo de compania
@param pCurrencycode Codigo de moneda
@param pMinterm Plazo minnimo 
@param pMinamount Monto minimo 
*/
public TgeneRatesGroupKey(String pInterestbalancetype,String pInterestbalancegroup,String pRatecatalog,String pRatecatalogcode,Integer pCompanycode,String pCurrencycode,Integer pMinterm,BigDecimal pMinamount){
 interestbalancetype=pInterestbalancetype;
 interestbalancegroup=pInterestbalancegroup;
 ratecatalog=pRatecatalog;
 ratecatalogcode=pRatecatalogcode;
 companycode=pCompanycode;
 currencycode=pCurrencycode;
 minterm=pMinterm;
 minamount=pMinamount;
}
/**Obtiene el valor de interestbalancetype
@return valor de interestbalancetype*/
public String getInterestbalancetype(){
  return interestbalancetype;
}
/**Fija el valor de interestbalancetype
@param pInterestbalancetype nuevo Valor de interestbalancetype*/
public void setInterestbalancetype(String pInterestbalancetype){
  interestbalancetype=pInterestbalancetype;
}

/**Obtiene el valor de interestbalancegroup
@return valor de interestbalancegroup*/
public String getInterestbalancegroup(){
  return interestbalancegroup;
}
/**Fija el valor de interestbalancegroup
@param pInterestbalancegroup nuevo Valor de interestbalancegroup*/
public void setInterestbalancegroup(String pInterestbalancegroup){
  interestbalancegroup=pInterestbalancegroup;
}

/**Obtiene el valor de ratecatalog
@return valor de ratecatalog*/
public String getRatecatalog(){
  return ratecatalog;
}
/**Fija el valor de ratecatalog
@param pRatecatalog nuevo Valor de ratecatalog*/
public void setRatecatalog(String pRatecatalog){
  ratecatalog=pRatecatalog;
}

/**Obtiene el valor de ratecatalogcode
@return valor de ratecatalogcode*/
public String getRatecatalogcode(){
  return ratecatalogcode;
}
/**Fija el valor de ratecatalogcode
@param pRatecatalogcode nuevo Valor de ratecatalogcode*/
public void setRatecatalogcode(String pRatecatalogcode){
  ratecatalogcode=pRatecatalogcode;
}

/**Obtiene el valor de companycode
@return valor de companycode*/
public Integer getCompanycode(){
  return companycode;
}
/**Fija el valor de companycode
@param pCompanycode nuevo Valor de companycode*/
public void setCompanycode(Integer pCompanycode){
  companycode=pCompanycode;
}

/**Obtiene el valor de currencycode
@return valor de currencycode*/
public String getCurrencycode(){
  return currencycode;
}
/**Fija el valor de currencycode
@param pCurrencycode nuevo Valor de currencycode*/
public void setCurrencycode(String pCurrencycode){
  currencycode=pCurrencycode;
}

/**Obtiene el valor de minterm
@return valor de minterm*/
public Integer getMinterm(){
  return minterm;
}
/**Fija el valor de minterm
@param pMinterm nuevo Valor de minterm*/
public void setMinterm(Integer pMinterm){
  minterm=pMinterm;
}

/**Obtiene el valor de minamount
@return valor de minamount*/
public BigDecimal getMinamount(){
  return minamount;
}
/**Fija el valor de minamount
@param pMinamount nuevo Valor de minamount*/
public void setMinamount(BigDecimal pMinamount){
  minamount=pMinamount;
}

/**Implementación de la comparación de TgeneRatesGroupKey
@param o Objeto de comparación
*/
public boolean equals(Object o){
  if (o == null)return false;
  if (! (o instanceof TgeneRatesGroupKey))return false;
  TgeneRatesGroupKey that = (TgeneRatesGroupKey) o;
  if (this.getInterestbalancetype() == null || that.getInterestbalancetype() == null){
      return false;
  }
  if (! this.getInterestbalancetype().equals(that.getInterestbalancetype())){
    return false;
  }
  if (this.getInterestbalancegroup() == null || that.getInterestbalancegroup() == null){
      return false;
  }
  if (! this.getInterestbalancegroup().equals(that.getInterestbalancegroup())){
    return false;
  }
  if (this.getRatecatalog() == null || that.getRatecatalog() == null){
      return false;
  }
  if (! this.getRatecatalog().equals(that.getRatecatalog())){
    return false;
  }
  if (this.getRatecatalogcode() == null || that.getRatecatalogcode() == null){
      return false;
  }
  if (! this.getRatecatalogcode().equals(that.getRatecatalogcode())){
    return false;
  }
  if (this.getCompanycode() == null || that.getCompanycode() == null){
      return false;
  }
  if (! this.getCompanycode().equals(that.getCompanycode())){
    return false;
  }
  if (this.getCurrencycode() == null || that.getCurrencycode() == null){
      return false;
  }
  if (! this.getCurrencycode().equals(that.getCurrencycode())){
    return false;
  }
  if (this.getMinterm() == null || that.getMinterm() == null){
      return false;
  }
  if (! this.getMinterm().equals(that.getMinterm())){
    return false;
  }
  if (this.getMinamount() == null || that.getMinamount() == null){
      return false;
  }
  if (! this.getMinamount().equals(that.getMinamount())){
    return false;
  }
  return true;
}
/**Implementación del método hashCode bajo el patrón de Bloch
@return hashCode de la instancia TgeneRatesGroupKey
*/
public int hashCode(){
  if (this.hashValue == 0){
    int result = 17;
    result = result * 37 + (this.getInterestbalancetype() == null ? 0 : this.getInterestbalancetype().hashCode());
    result = result * 37 + (this.getInterestbalancegroup() == null ? 0 : this.getInterestbalancegroup().hashCode());
    result = result * 37 + (this.getRatecatalog() == null ? 0 : this.getRatecatalog().hashCode());
    result = result * 37 + (this.getRatecatalogcode() == null ? 0 : this.getRatecatalogcode().hashCode());
    result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode());
    result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode());
    result = result * 37 + (this.getMinterm() == null ? 0 : this.getMinterm().hashCode());
    result = result * 37 + (this.getMinamount() == null ? 0 : this.getMinamount().hashCode());
    this.hashValue = result;
  }
  return this.hashValue;
}
public Object cloneMe() throws CloneNotSupportedException {
  return this.clone();
}
/**Implementación toString
*/
public String toString() {
	Field[]fs=this.getClass().getDeclaredFields();
	String data="";
	for(Field f:fs){
	 try{	
	 String name=f.getName();
   if(f.getType().getName().compareTo("java.util.Set")==0)continue;
	 if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue;
		data+="pk."+name+"="+f.get(this)+";";
	 }catch(Exception e){
		 continue;
	 }
		}
		if(data.compareTo("")==0){
		data=super.toString();
		}
	return data;
	}
}
