package ru.nbch.credit_tracker.utils.error;

import ru.nbch.credit_tracker.enums.EnumKeyMessage;

import java.util.Arrays;


public class SimpleMessageResolver {
    public String resolve(EnumKeyMessage errorMessage) {
        if (errorMessage == null) return "null";
        if(errorMessage.getArgs().length == 0)  {
            return errorMessage.getSubject().getKey();
        } else {
            return errorMessage.getSubject().getKey().replace("{}", Arrays.toString(errorMessage.getArgs()));
        }
    }
}
