
package de.ivu.elect.presentation.personenpruefung;

import static java.util.Collections.unmodifiableList;
import static org.apache.commons.lang3.StringUtils.join;
import static org.apache.commons.lang3.StringUtils.trimToEmpty;

import java.io.Serializable;
import java.util.List;

public class PersonenPruefSchrittFormatted implements Serializable {

  private static final long serialVersionUID = 1L;

  private final String label;

  private final List<String> details;

  public PersonenPruefSchrittFormatted(String label, List<String> details) {
    super();

    this.label = label;
    this.details = unmodifiableList(details);
  }

  public String getLabel() {
    return label;
  }

  public List<String> getDetails() {
    return details;
  }

  @Override
  public String toString() {
    String result = trimToEmpty(getLabel());

    if (!getDetails().isEmpty()) {
      result += " (" + join(getDetails(), ", ") + ")";
    }

    return result;
  }
}
