package de.ivu.elect.jee.presentation.status;

import java.io.Serializable;

/**
 *  on 26.05.2017.
 */
public class StatusOption implements Serializable {

  private final StatusOptionType type;

  private final Serializable payload;

  public StatusOption(StatusOptionType type) {
    this(type, null);
  }

  public StatusOption(StatusOptionType type, Serializable payload) {
    this.type = type;
    this.payload = payload;
  }

  public StatusOptionType getType() {
    return type;
  }

  public Serializable getPayload() {
    return payload;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    StatusOption that = (StatusOption) o;

    if (type != null ? !type.equals(that.type) : that.type != null) return false;
    return payload != null ? payload.equals(that.payload) : that.payload == null;
  }

  @Override
  public int hashCode() {
    int result = type != null ? type.hashCode() : 0;
    result = 31 * result + (payload != null ? payload.hashCode() : 0);
    return result;
  }

  @Override
  public String toString() {
    return "StatusOption{" +
            "type=" + type +
            ", payload=" + payload +
            '}';
  }
}
