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

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

  private static final long serialVersionUID = 1L;

    protected final java.lang.Long nummer;

    public java.lang.Long getNummer(){
      return nummer;
    }


  public MandantUK(
java.lang.Long nummer
  ) {
    super();


      this.nummer = nummer;
      }

  @Override
  public int hashCode() {
        int result = 1;
    
    
                    result = result + ((nummer == null) ? 0 : nummer.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;
    }

            MandantUK other = (MandantUK) obj;

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

  @Override
  public String getEntityMessageKey() {
    return MandantConstants.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(MandantConstants.MESSAGE_KEY_ENTITY_EINZAHL, MandantConstants.MESSAGE_KEY_NUMMER_EINZAHL, nummer));
        
        return result;
      }
  
    @Override
  public String toString() {
    return "MandantUK[" + toStringParameter() + "]";
  }

            protected String toStringParameter() {
              String result = ""

                                                        +"nummer="+nummer
                                    ;
                          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(nummer);
     return list;
   }

            public static <E extends Mandant> java.util.Map<MandantUK, E> mappeMandantNachUK(java.util.Collection<E> entities) {

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


                public static Function<Mandant, MandantUK> getMandantToUKFunction() {
                return Mandant::getMandantUK;
                }

}
