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

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

  private static final long serialVersionUID = 1L;

    protected final String rechtAsString;

    public String getRechtAsString(){
      return rechtAsString;
    }

  protected final de.ivu.elect.business.mandant.entity.MandantUK mandantUK;

    public de.ivu.elect.business.mandant.entity.MandantUK getMandantUK(){
      return mandantUK;
    }

  public RechteKonfigurationUK(
String rechtAsString
,   de.ivu.elect.business.mandant.entity.MandantUK mandantUK
  ) {
    super();


      this.rechtAsString = rechtAsString;
        this.mandantUK = mandantUK;
    }

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

            RechteKonfigurationUK other = (RechteKonfigurationUK) obj;

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

  @Override
  public String getEntityMessageKey() {
    return RechteKonfigurationConstants.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());
    result.addAll(mandantUK.getAllEntityFieldValues());
    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(RechteKonfigurationConstants.MESSAGE_KEY_ENTITY_EINZAHL, RechteKonfigurationConstants.MESSAGE_KEY_RECHT_EINZAHL, rechtAsString));
        
        return result;
      }
  
    @Override
  public String toString() {
    return "RechteKonfigurationUK[" + toStringParameter() + "]";
  }

            protected String toStringParameter() {
              String result = ""

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

            public static <E extends RechteKonfiguration> java.util.Map<RechteKonfigurationUK, E> mappeRechteKonfigurationNachUK(java.util.Collection<E> entities) {

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


                public static Function<RechteKonfiguration, RechteKonfigurationUK> getRechteKonfigurationToUKFunction() {
                return RechteKonfiguration::getRechteKonfigurationUK;
                }

}
