package com.oguerreiro.resilient.error;

public class VariableUnitConverterWithoutFormulaException extends ResilientException {
  private static final String CODE = "E019";

  private final String variableCode;
  private final String fromUnitCode;
  private final String toUnitCode;

  public VariableUnitConverterWithoutFormulaException(String variableCode, String fromUnitCode, String toUnitCode) {
    super("Variable Code [" + variableCode + "]; The unit converter from unit [" + fromUnitCode + "] to unit ["
        + toUnitCode + "] exists, but doesn't have a convertion formula defined. This is a configuration error.");

    this.variableCode = variableCode;
    this.fromUnitCode = fromUnitCode;
    this.toUnitCode = toUnitCode;

    addMessageArg(variableCode);
    addMessageArg(fromUnitCode);
    addMessageArg(toUnitCode);
  }

  @Override
  public String getMessageCode() {
    return CODE;
  }

  public String getVariableCode() {
    return variableCode;
  }

  public String getFromUnitCode() {
    return fromUnitCode;
  }

  public String getToUnitCode() {
    return toUnitCode;
  }

}
