"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TransactionAnnounceModeResolver = exports.TransactionAnnounceMode = void 0;
const options_resolver_1 = require("../options-resolver");
const publicKey_validator_1 = require("../validators/publicKey.validator");
const transactionAnnounceMode_validator_1 = require("../validators/transactionAnnounceMode.validator");
var TransactionAnnounceMode;
(function (TransactionAnnounceMode) {
    TransactionAnnounceMode["normal"] = "normal";
    TransactionAnnounceMode["multisig"] = "multisig";
})(TransactionAnnounceMode = exports.TransactionAnnounceMode || (exports.TransactionAnnounceMode = {}));
/**
 * Transaction announce mode resolver
 */
class TransactionAnnounceModeResolver {
    /**
     * @param networkType this network type.
     */
    constructor(networkType) {
        this.networkType = networkType;
    }
    /**
     * Resolves an import type provided by the user.
     * @param {CreateProfileOptions} options - Command options.
     * @returns {Promise<TransactionAnnounceMode>}
     */
    async resolve(options) {
        // Enter multisig mode if a valid signer public key was provided as an option
        if (new publicKey_validator_1.PublicKeyValidator(this.networkType).validate(options.signer) === true) {
            return TransactionAnnounceMode.multisig;
        }
        const choices = Object.keys(TransactionAnnounceMode).map((string) => ({
            title: string,
            value: string,
        }));
        return (0, options_resolver_1.OptionsChoiceResolver)(options, 'mode', 'Select the transaction announce mode:', choices, 'select', new transactionAnnounceMode_validator_1.TransactionAnnounceModeValidator());
    }
}
exports.TransactionAnnounceModeResolver = TransactionAnnounceModeResolver;
