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

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

  private static final long serialVersionUID = 1L;


  protected final de.ivu.elect.business.wahl.entity.WahlartUK wahlartUK;

    public de.ivu.elect.business.wahl.entity.WahlartUK getWahlartUK(){
      return wahlartUK;
    }
  protected final de.ivu.elect.business.wahl.entity.WahlterminUK wahlterminUK;

    public de.ivu.elect.business.wahl.entity.WahlterminUK getWahlterminUK(){
      return wahlterminUK;
    }

  public WahlUK(
  de.ivu.elect.business.wahl.entity.WahlartUK wahlartUK
,   de.ivu.elect.business.wahl.entity.WahlterminUK wahlterminUK
  ) {
    super();


        this.wahlartUK = wahlartUK;
      this.wahlterminUK = wahlterminUK;
    }

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

            WahlUK other = (WahlUK) obj;

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

  @Override
  public String getEntityMessageKey() {
    return WahlConstants.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(wahlartUK.getAllEntityFieldValues());
    result.addAll(wahlterminUK.getAllEntityFieldValues());
    return result;
  }

  @Override
  public java.util.List<de.ivu.elect.jee.entity.tk.EntityFieldValue> getEntityFieldValuesForEntity() {
            return java.util.Collections.emptyList();
      }
  
    @Override
  public String toString() {
    return "WahlUK[" + toStringParameter() + "]";
  }

            protected String toStringParameter() {
              String result = ""

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

            public static <E extends Wahl> java.util.Map<WahlUK, E> mappeWahlNachUK(java.util.Collection<E> entities) {

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


                public static Function<Wahl, WahlUK> getWahlToUKFunction() {
                return Wahl::getWahlUK;
                }

}
