#pragma once

#include <boost/asio/io_context.hpp>

#include <optional>
#include <thread>
#include <vector>

// This is so that the io_context can outlive all the children
class BasicApp
{
private:
    std::optional<boost::asio::executor_work_guard<boost::asio::io_context::executor_type>> work_;
    std::vector<std::thread> threads_;
    boost::asio::io_context io_context_;

public:
    BasicApp(std::size_t numberOfThreads);
    ~BasicApp();

    boost::asio::io_context&
    get_io_context()
    {
        return io_context_;
    }

    size_t
    get_number_of_threads() const
    {
        return threads_.size();
    }
};
