#include <net/poettering/Calculator/aserver.hpp>
#include <sdbusplus/async.hpp>

class Calculator :
    public sdbusplus::aserver::net::poettering::Calculator<Calculator>
{
  public:
    explicit Calculator(sdbusplus::async::context& ctx) :
        sdbusplus::aserver::net::poettering::Calculator<Calculator>(
            ctx, "/net/poettering/calculator"),
        manager(ctx, "/")
    {
        ctx.spawn(startup());
    }

  private:
    auto startup() -> sdbusplus::async::task<>
    {
        ctx.get_bus().request_name("net.poettering.Calculator");

        while (1)
        {
            using namespace std::literals;
            co_await sdbusplus::async::sleep_for(ctx, 10s);

            cleared(42);
        }
        co_return;
    }

    sdbusplus::server::manager_t manager;
};

int main()
{
    sdbusplus::async::context ctx;
    [[maybe_unused]] Calculator c(ctx);

    ctx.run();

    return 0;
}
