"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HashAlgorithmResolver = void 0;
const symbol_sdk_1 = require("symbol-sdk");
const options_resolver_1 = require("../options-resolver");
const hashAlgorithm_validator_1 = require("../validators/hashAlgorithm.validator");
/**
 * Link hashAlgorithm resolver
 */
class HashAlgorithmResolver {
    /**
     * Resolves an hashAlgorithm 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.LockHashAlgorithm)
            .filter((key) => Number.isNaN(parseFloat(key)))
            .map((string) => ({
            title: string,
            value: symbol_sdk_1.LockHashAlgorithm[string],
        }));
        const value = +(await (0, options_resolver_1.OptionsChoiceResolver)(options, altKey ? altKey : 'hashAlgorithm', altText ? altText : 'Select the algorithm used to hash the proof:', choices, 'select', new hashAlgorithm_validator_1.HashAlgorithmValidator()));
        return value;
    }
}
exports.HashAlgorithmResolver = HashAlgorithmResolver;
