var expectedRateModelKeys = ["UBar", "R0", "R1", "R2"];
/**
 * Helper method that returns parsed rate model from string, or throws.
 * @param rateModelString Stringified rate model to parse.
 * @returns Rate model object. Must conform to `expectedRateModelKeys` format.
 */
export var parseAndReturnRateModelFromString = function (rateModelString) {
    var rateModelFromEvent = JSON.parse(rateModelString);
    // Rate model must contain the exact same keys in `expectedRateModelKeys`.
    for (var _i = 0, expectedRateModelKeys_1 = expectedRateModelKeys; _i < expectedRateModelKeys_1.length; _i++) {
        var key = expectedRateModelKeys_1[_i];
        if (!Object.keys(rateModelFromEvent).includes(key)) {
            throw new Error("Rate model does not contain all expected keys. Expected keys: [".concat(expectedRateModelKeys, "], actual keys: [").concat(Object.keys(rateModelFromEvent), "]"));
        }
    }
    for (var _a = 0, _b = Object.keys(rateModelFromEvent); _a < _b.length; _a++) {
        var key = _b[_a];
        if (!expectedRateModelKeys.includes(key)) {
            throw new Error("Rate model contains unexpected keys. Expected keys: [".concat(expectedRateModelKeys, "], actual keys: [").concat(Object.keys(rateModelFromEvent), "]"));
        }
    }
    return {
        UBar: rateModelFromEvent.UBar,
        R0: rateModelFromEvent.R0,
        R1: rateModelFromEvent.R1,
        R2: rateModelFromEvent.R2,
    };
};
//# sourceMappingURL=rateModel.js.map