/*
 * Anomaly
 *
 * Created on 12.10.2009
 * Copyright (c) 2009 Kiesraad
 */
package de.ivu.wahl.result.result;

import de.ivu.wahl.result.i18n.Messages;

import java.util.List;

/**
 * An Anomaly contains a piece of information about an exceptional event in the seat distribution
 * process, like
 * <ul>
 * <li>exhausted list</li>
 * <li>absolute majority</li>
 * </ul>
 * For one exceptional event usually more than one Anomaly object will be created.
 *
 * @author , IVU Traffic Technologies AG
 */
public class Anomaly {
  private final String messageKey;
  private final List<String> parameters;
  private final int index;
  private final boolean shallBePublishedInModelP22;

  public Anomaly(String messageKey, List<String> parameters, int number, boolean shallBePublishedInModelP22) {
    this.messageKey = messageKey;
    this.parameters = parameters;
    this.index = number;
    this.shallBePublishedInModelP22 = shallBePublishedInModelP22;
  }

  public String getMessageKey() {
    return messageKey;
  }

  public List<String> getParameters() {
    return parameters;
  }

  public String getText() {
    return Messages.bind(messageKey, parameters.toArray(new Object[0]));
  }

  public int getIndex() {
    return index;
  }

  public boolean isShallBePublishedInModelP22() {
    return shallBePublishedInModelP22;
  }
}
