package com.oguerreiro.resilient.error;

public class VariableUnitConverterNotFoundException extends ResilientException {
  private static final String CODE = "E018";

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

  public VariableUnitConverterNotFoundException(String variableCode, String fromUnitCode, String toUnitCode) {
    super("Variable Code [" + variableCode
        + "]; A unit convertion is needed, but no converter is configured to convert the value from the unit ["
        + fromUnitCode + "] in the unit [" + toUnitCode + "].");

    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;
  }

}
