"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TransactionURIResolver = void 0;
const symbol_sdk_1 = require("symbol-sdk");
const symbol_uri_scheme_1 = require("symbol-uri-scheme");
const options_resolver_1 = require("../options-resolver");
const transactionURI_validator_1 = require("../validators/transactionURI.validator");
/**
 * TransactionURI resolver
 */
class TransactionURIResolver {
    /**
     * Resolves a Transaction URI provided by the user.
     * @param {Options} options - Command options.
     * @param {Profile} secondSource - Secondary data source.
     * @param {string} altText - Alternative text.
     * @param {string} altKey - Alternative key.
     * @returns {Promise<string>}
     */
    async resolve(options, secondSource, altText, altKey) {
        const resolution = await (0, options_resolver_1.OptionsResolver)(options, altKey ? altKey : 'uri', () => (secondSource ? secondSource.url : undefined), altText ? altText : 'Enter the Transaction URI:', 'text', new transactionURI_validator_1.TransactionURIValidator());
        return symbol_uri_scheme_1.TransactionURI.fromURI(resolution, symbol_sdk_1.TransactionMapping.createFromPayload);
    }
}
exports.TransactionURIResolver = TransactionURIResolver;
