#pragma once
#include <myapp/async/eventloop.h>
#include <memory>
#include <uvw.hpp>

namespace myapp::async {

class uv_event_loop final : public event_loop
{
public:
    explicit uv_event_loop(std::shared_ptr<uvw::Loop>);
    ~uv_event_loop();

    uv_event_loop(uv_event_loop &&) noexcept = default;
    uv_event_loop& operator=(uv_event_loop &&) noexcept = default;

    uvw::Loop& handle() noexcept;
    uvw::Loop const& handle() const noexcept;

    void run() override;
    void run_once();
    void stop() override;

private:
    std::shared_ptr<uvw::Loop> loop_;
};

} /* namespace myapp::async */
