"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RestrictionAccountOperationFlagsResolver = exports.RestrictionAccountMosaicFlagsResolver = exports.RestrictionAccountAddressFlagsResolver = 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 account address flags resolver
 */
class RestrictionAccountAddressFlagsResolver {
    /**
     * Resolves a restriction account address flag provided by the user.
     * @param {Options} options - Command options.
     * @param {string} altText - Alternative text.
     * @param {string} altKey - Alternative key.
     * @returns {Promise<number>}
     */
    async resolve(options, altText, altKey) {
        const choices = Object.keys(symbol_sdk_1.AddressRestrictionFlag)
            .filter((key) => Number.isNaN(parseFloat(key)))
            .map((string) => ({
            title: string,
            value: symbol_sdk_1.AddressRestrictionFlag[string],
        }));
        const value = +(await (0, options_resolver_1.OptionsChoiceResolver)(options, altKey ? altKey : 'flags', altText ? altText : 'Select the restriction flags:', choices, 'select', new restrictionType_validator_1.RestrictionAccountAddressFlagValidator()));
        return value;
    }
}
exports.RestrictionAccountAddressFlagsResolver = RestrictionAccountAddressFlagsResolver;
/**
 * Restriction account mosaic flags resolver
 */
class RestrictionAccountMosaicFlagsResolver {
    /**
     * Resolves a restriction account mosaic flag provided by the user.
     * @param {Options} options - Command options.
     * @param {string} altText - Alternative text.
     * @param {string} altKey - Alternative key.
     * @returns {Promise<number>}
     */
    async resolve(options, altText, altKey) {
        const choices = Object.keys(symbol_sdk_1.MosaicRestrictionFlag)
            .filter((key) => Number.isNaN(parseFloat(key)))
            .map((string) => ({
            title: string,
            value: symbol_sdk_1.MosaicRestrictionFlag[string],
        }));
        const value = +(await (0, options_resolver_1.OptionsChoiceResolver)(options, altKey ? altKey : 'flags', altText ? altText : 'Select the restriction flags:', choices, 'select', new restrictionType_validator_1.RestrictionAccountMosaicFlagValidator()));
        return value;
    }
}
exports.RestrictionAccountMosaicFlagsResolver = RestrictionAccountMosaicFlagsResolver;
/**
 * Restriction account operation flags resolver
 */
class RestrictionAccountOperationFlagsResolver {
    /**
     * Resolves a restriction account operation flag provided by the user.
     * @param {Options} options - Command options.
     * @param {string} altText - Alternative text.
     * @param {string} altKey - Alternative key.
     * @returns {Promise<number>}
     */
    async resolve(options, altText, altKey) {
        const choices = Object.keys(symbol_sdk_1.OperationRestrictionFlag)
            .filter((key) => Number.isNaN(parseFloat(key)))
            .map((string) => ({
            title: string,
            value: symbol_sdk_1.OperationRestrictionFlag[string],
        }));
        const value = +(await (0, options_resolver_1.OptionsChoiceResolver)(options, altKey ? altKey : 'flags', altText ? altText : 'Select the restriction flags:', choices, 'select', new restrictionType_validator_1.RestrictionAccountOperationFlagValidator()));
        return value;
    }
}
exports.RestrictionAccountOperationFlagsResolver = RestrictionAccountOperationFlagsResolver;
