"use strict";
/*
 * Copyright 2020 NEM
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
Object.defineProperty(exports, "__esModule", { value: true });
const command_1 = require("@oclif/command");
const service_1 = require("../service");
const AnnounceService_1 = require("../service/AnnounceService");
const CommandUtils_1 = require("../service/CommandUtils");
class EnrolRewardProgram extends command_1.Command {
    async run() {
        const { flags } = this.parse(EnrolRewardProgram);
        service_1.BootstrapUtils.showBanner();
        flags.password = await CommandUtils_1.CommandUtils.resolvePassword(flags.password, flags.noPassword, CommandUtils_1.CommandUtils.passwordPromptDefaultMessage, true);
        return new service_1.BootstrapService(this.config.root).enrolRewardProgram(flags);
    }
}
exports.default = EnrolRewardProgram;
EnrolRewardProgram.description = `It enrols the nodes in the rewards program by announcing the enrol transaction to the registration address.  You can also use this command to update the program registration when you change the node public key or server host.

Currently, the only program that can be enrolled post-launch is 'SuperNode'.`;
EnrolRewardProgram.examples = [
    `$ symbol-bootstrap enrolRewardProgram`,
    `$ symbol-bootstrap enrolRewardProgram --noPassword`,
    `$ symbol-bootstrap enrolRewardProgram --useKnownRestGateways`,
    `$ symbol-bootstrap enrolRewardProgram --password 1234 --url http://external-rest:3000`,
    `$ echo "$MY_ENV_VAR_PASSWORD" | symbol-bootstrap enrolRewardProgram --url http://external-rest:3000`,
];
EnrolRewardProgram.flags = Object.assign({ help: CommandUtils_1.CommandUtils.helpFlag, target: CommandUtils_1.CommandUtils.targetFlag }, AnnounceService_1.AnnounceService.flags);
