
package de.ivu.elect.business.konfiguration.entity;

import java.io.Serializable;

import javax.annotation.Nullable;
import javax.enterprise.event.Event;
import javax.inject.Inject;

import de.ivu.elect.business.mandant.entity.Mandant;

public class KonfigurationWertGeaendertEvent implements Serializable {

  private static final long serialVersionUID = 1L;

  @Inject
  private transient Event<KonfigurationWertGeaendertEvent> event;

  private final Mandant mandant;

  private final ElectSystemMandantKonfigurationWerte key;

  private final String keyValue;

  private final String neuerWert;

  protected KonfigurationWertGeaendertEvent() {
    this(null, null, null, null);
  }

  public KonfigurationWertGeaendertEvent(Mandant mandant, ElectSystemMandantKonfigurationWerte key, @Nullable String neuerWert, String keyValue) {
    super();
    this.mandant = mandant;
    this.key = key;
    this.keyValue = keyValue;
    this.neuerWert = neuerWert;
  }

  public ElectSystemMandantKonfigurationWerte getKey() {
    return key;
  }

  public String getKeyValue() {
    return keyValue;
  }

  @Nullable
  public String getNeuerWert() {
    return neuerWert;
  }

  public Mandant getMandant() {
    return mandant;
  }

  public void sendWertGeaendertEvent(Mandant mandant, ElectSystemMandantKonfigurationWerte key, @Nullable String neuerWert, String keyValue) {
    event.fire(new KonfigurationWertGeaendertEvent(mandant, key, neuerWert, keyValue));
  }
}
