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 TGENESEGMENTRATE*/
@Embeddable
public class TgeneSegmentRateKey  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 de interes a calcular.
*/
private String interestbalancetype;

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

/**
* Código de grupo de balance del tipo de saldo.
*/
private String interestbalancegroup;

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

/**
* Segmento asociado al tipo de producto de prestamo
*/
private String creditsegmentcatalog;

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

/**
* Catalogo asociado al segmento de producto de prestamo
*/
private String creditsegmentcatalogcode;

@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 TgeneSegmentRateKey(){}
/**Contructor de TgeneSegmentRateKey
@param pInterestbalancetype Código de tipo de saldo de interes a calcular.
@param pInterestbalancegroup Código de grupo de balance del tipo de saldo.
@param pCreditsegmentcatalog Segmento asociado al tipo de producto de prestamo
@param pCreditsegmentcatalogcode Catalogo asociado al segmento de producto de prestamo
@param pCompanycode Codigo de compania
@param pCurrencycode Codigo de moneda
@param pMinterm Plazo minnimo 
@param pMinamount Monto minimo 
*/
public TgeneSegmentRateKey(String pInterestbalancetype,String pInterestbalancegroup,String pCreditsegmentcatalog,String pCreditsegmentcatalogcode,Integer pCompanycode,String pCurrencycode,Integer pMinterm,BigDecimal pMinamount){
 interestbalancetype=pInterestbalancetype;
 interestbalancegroup=pInterestbalancegroup;
 creditsegmentcatalog=pCreditsegmentcatalog;
 creditsegmentcatalogcode=pCreditsegmentcatalogcode;
 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 creditsegmentcatalog
@return valor de creditsegmentcatalog*/
public String getCreditsegmentcatalog(){
  return creditsegmentcatalog;
}
/**Fija el valor de creditsegmentcatalog
@param pCreditsegmentcatalog nuevo Valor de creditsegmentcatalog*/
public void setCreditsegmentcatalog(String pCreditsegmentcatalog){
  creditsegmentcatalog=pCreditsegmentcatalog;
}

/**Obtiene el valor de creditsegmentcatalogcode
@return valor de creditsegmentcatalogcode*/
public String getCreditsegmentcatalogcode(){
  return creditsegmentcatalogcode;
}
/**Fija el valor de creditsegmentcatalogcode
@param pCreditsegmentcatalogcode nuevo Valor de creditsegmentcatalogcode*/
public void setCreditsegmentcatalogcode(String pCreditsegmentcatalogcode){
  creditsegmentcatalogcode=pCreditsegmentcatalogcode;
}

/**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;
}

/**Implementacion de la comparacion de TgeneSegmentRateKey
@param o Objeto de comparacion
*/
public boolean equals(Object o){
  if (o == null)return false;
  if (! (o instanceof TgeneSegmentRateKey))return false;
  TgeneSegmentRateKey that = (TgeneSegmentRateKey) 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.getCreditsegmentcatalog() == null || that.getCreditsegmentcatalog() == null){
      return false;
  }
  if (! this.getCreditsegmentcatalog().equals(that.getCreditsegmentcatalog())){
    return false;
  }
  if (this.getCreditsegmentcatalogcode() == null || that.getCreditsegmentcatalogcode() == null){
      return false;
  }
  if (! this.getCreditsegmentcatalogcode().equals(that.getCreditsegmentcatalogcode())){
    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;
}
/**Implementacion del metodo hashCode bajo el patron de Bloch
@return hashCode de la instancia TgeneSegmentRateKey
*/
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.getCreditsegmentcatalog() == null ? 0 : this.getCreditsegmentcatalog().hashCode());
    result = result * 37 + (this.getCreditsegmentcatalogcode() == null ? 0 : this.getCreditsegmentcatalogcode().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();
}
/**Implementacion 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;
	}
}
