"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RestrictionTypeResolver = void 0;
const symbol_sdk_1 = require("symbol-sdk");
const options_resolver_1 = require("../options-resolver");
const restrictionType_validator_1 = require("../validators/restrictionType.validator");
/**
 * Restriction type resolver
 */
class RestrictionTypeResolver {
    /**
     * Resolve a restriction type provided by a user.
     * @param {Options} options - Command options.
     * @param {string} altText - Alternative text.
     * @param {string} altKey - Alternative key.
     * @return {Promise<number>}
     */
    async resolve(options, altText, altKey) {
        const choices = Object.keys(symbol_sdk_1.MosaicRestrictionType)
            .filter((key) => Number.isNaN(parseFloat(key)))
            .map((string) => ({
            title: string,
            value: symbol_sdk_1.MosaicRestrictionType[string],
        }));
        const value = +(await (0, options_resolver_1.OptionsChoiceResolver)(options, altKey ? altKey : 'newRestrictionType', altText ? altText : 'Select the new restriction type:', choices, 'select', new restrictionType_validator_1.RestrictionMosaicTypeValidator()));
        return value;
    }
}
exports.RestrictionTypeResolver = RestrictionTypeResolver;
