/*
 * Unique Schlüssel für JPA Entität
 */
package de.ivu.elect.business.staat.entity;
import java.util.function.Function;
import java.util.ArrayList;
import java.util.stream.Collectors;

@javax.enterprise.inject.Vetoed
public class StaatUK
implements de.ivu.elect.jee.entity.tk.EntityUK, java.io.Serializable
  {

  private static final long serialVersionUID = 1L;

    protected final java.lang.String customCodeStaat;

    public java.lang.String getCustomCodeStaat(){
      return customCodeStaat;
    }


  public StaatUK(
java.lang.String customCodeStaat
  ) {
    super();


      this.customCodeStaat = customCodeStaat;
      }

  @Override
  public int hashCode() {
        int result = 1;
    
    
                    result = result + ((customCodeStaat == null) ? 0 : customCodeStaat.hashCode());
        
            
    return result;
  }

  @Override
  public boolean equals(Object obj) {
    if (this == obj) {
      return true;
    }

    if (obj == null) {
      return false;
    }

    
    if (getClass() != obj.getClass()) {
      return false;
    }

            StaatUK other = (StaatUK) obj;

                if (customCodeStaat == null) {
          if (other.customCodeStaat != null) {
            return false;
          }
        } else if (!customCodeStaat.equals(other.customCodeStaat)) {
          return false;
        }
        
            
    return true;
  }

  @Override
  public String getEntityMessageKey() {
    return StaatConstants.MESSAGE_KEY_ENTITY_EINZAHL;
  }

  @Override
  public java.util.List<de.ivu.elect.jee.entity.tk.EntityFieldValue> getAllEntityFieldValues() {
    java.util.List<de.ivu.elect.jee.entity.tk.EntityFieldValue> result = new java.util.ArrayList<>();

    result.addAll(getEntityFieldValuesForEntity());
    return result;
  }

  @Override
  public java.util.List<de.ivu.elect.jee.entity.tk.EntityFieldValue> getEntityFieldValuesForEntity() {
            java.util.List<de.ivu.elect.jee.entity.tk.EntityFieldValue> result = new java.util.ArrayList<>();

                    result.add(new de.ivu.elect.jee.entity.tk.EntityFieldValue(StaatConstants.MESSAGE_KEY_ENTITY_EINZAHL, StaatConstants.MESSAGE_KEY_CODE_STAAT_EINZAHL, customCodeStaat));
        
        return result;
      }
  
    @Override
  public String toString() {
    return "StaatUK[" + toStringParameter() + "]";
  }

            protected String toStringParameter() {
              String result = ""

                                                        +"customCodeStaat="+customCodeStaat
                                    ;
                          return result;
            
            }




          public String allUKFields() {
    return String.join(", ", getAllUKFieldValues().stream()
         .map(object -> (object != null ? object.toString() : null))
         .collect(Collectors.toList()));
    }

   protected ArrayList<Object> getAllUKFieldValues() {
              ArrayList<Object> list = new ArrayList<>();
              list.add(customCodeStaat);
     return list;
   }

            public static <E extends Staat> java.util.Map<StaatUK, E> mappeStaatNachUK(java.util.Collection<E> entities) {

                return entities.stream().collect(java.util.stream.Collectors.toMap(Staat::getStaatUK, Function.<E>identity(), (u,v)->v));
             }


                public static Function<Staat, StaatUK> getStaatToUKFunction() {
                return Staat::getStaatUK;
                }

}
