#pragma once

#include <memory>
#include <optional>

#include "bootstrap/RuntimeHandles.h"

namespace ta::adapters::windows::console
{
    class WindowsConsoleSession;
}

namespace ta::presentation
{
    class MenuController;
}

namespace ta::bootstrap
{
    class ApplicationRuntime;

    class RuntimeShutdown final
    {
    public:
        RuntimeShutdown(
            ta::adapters::windows::console::WindowsConsoleSession& console,
            std::unique_ptr<ApplicationRuntime>& application,
            std::unique_ptr<ta::presentation::MenuController>& menu,
            std::optional<PresentHookHandle>& present_hook,
            std::optional<FeatureHooksHandle>& feature_hooks) noexcept;

        [[nodiscard]] bool run(bool rollback) noexcept;

    private:
        ta::adapters::windows::console::WindowsConsoleSession& console_;
        std::unique_ptr<ApplicationRuntime>& application_;
        std::unique_ptr<ta::presentation::MenuController>& menu_;
        std::optional<PresentHookHandle>& present_hook_;
        std::optional<FeatureHooksHandle>& feature_hooks_;
    };
}
