"use strict";
// SPDX-License-Identifier: Apache-2.0
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DisconnectCommandHandler = void 0;
const CommandHandlerDecorator_1 = require("../../../../../core/decorator/CommandHandlerDecorator");
const Injectable_1 = __importDefault(require("../../../../../core/injectable/Injectable"));
const DisconnectCommand_1 = require("./DisconnectCommand");
const DisconnectCommandError_1 = require("./error/DisconnectCommandError");
let DisconnectCommandHandler = class DisconnectCommandHandler {
    async execute() {
        try {
            const handler = Injectable_1.default.resolveTransactionHandler();
            const res = await handler.stop();
            return new DisconnectCommand_1.DisconnectCommandResponse(res);
        }
        catch (error) {
            throw new DisconnectCommandError_1.DisconnectCommandError(error);
        }
    }
};
exports.DisconnectCommandHandler = DisconnectCommandHandler;
exports.DisconnectCommandHandler = DisconnectCommandHandler = __decorate([
    (0, CommandHandlerDecorator_1.CommandHandler)(DisconnectCommand_1.DisconnectCommand)
], DisconnectCommandHandler);
