/*
 * 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 WahlterminUK
implements de.ivu.elect.jee.entity.tk.EntityUK, java.io.Serializable
  {

  private static final long serialVersionUID = 1L;

    protected final java.lang.String nummer;

    public java.lang.String getNummer(){
      return nummer;
    }
    protected final java.util.Date wahldatum;

    public java.util.Date getWahldatum(){
      return wahldatum;
    }

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

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

  public WahlterminUK(
java.lang.String nummer
, java.util.Date wahldatum
,   de.ivu.elect.business.mandant.entity.MandantUK mandantUK
  ) {
    super();


      this.nummer = nummer;
      this.wahldatum = wahldatum;
        this.mandantUK = mandantUK;
    }

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

            WahlterminUK other = (WahlterminUK) obj;

                if (nummer == null) {
          if (other.nummer != null) {
            return false;
          }
        } else if (!nummer.equals(other.nummer)) {
          return false;
        }
                if (wahldatum == null) {
          if (other.wahldatum != null) {
            return false;
          }
        } else if (!wahldatum.equals(other.wahldatum)) {
          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 WahlterminConstants.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(WahlterminConstants.MESSAGE_KEY_ENTITY_EINZAHL, WahlterminConstants.MESSAGE_KEY_NUMMER_EINZAHL, nummer));
                    result.add(new de.ivu.elect.jee.entity.tk.EntityFieldValue(WahlterminConstants.MESSAGE_KEY_ENTITY_EINZAHL, WahlterminConstants.MESSAGE_KEY_WAHLDATUM_EINZAHL, wahldatum));
        
        return result;
      }
  
    @Override
  public String toString() {
    return "WahlterminUK[" + toStringParameter() + "]";
  }

            protected String toStringParameter() {
              String result = ""

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

            public static <E extends Wahltermin> java.util.Map<WahlterminUK, E> mappeWahlterminNachUK(java.util.Collection<E> entities) {

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


                public static Function<Wahltermin, WahlterminUK> getWahlterminToUKFunction() {
                return Wahltermin::getWahlterminUK;
                }

}
