#pragma once
#include <myapp/async/eventloop.h>
#include <myapp/async/pipe.h>
#include <myapp/async/signal.h>
#include <myapp/cmdargs/options.h>
#include <myapp/configuration/config.h>
#include <myapp/rcon/client.h>

namespace myapp {

class rcon_facade final
{
public:
    explicit rcon_facade(cmdargs::options&, configuration::config&);

    void loop();

private:
    void set_console_termination_handlers();
    void redirect_console_to_remote();

private:
    cmdargs::options& options_;
    configuration::config& config_;
    std::shared_ptr<logging::logger> logger_;
    std::shared_ptr<async::event_loop> loop_;
    std::unique_ptr<async::signal> sigint_;
    std::unique_ptr<async::signal> sigterm_;
    std::unique_ptr<async::pipe> stdin_;
    rcon::client rcon_;
};

} /* namespace myapp */
