#pragma once

#include "fgc/ui/IUserInterface.h"

#include <atomic>
#include <thread>

namespace fgc {

// The default, no-decoration interface: a stdin reader thread that forwards each
// line to the command sink, with logs going to stdout/stderr via the Logger's
// default writer. This is exactly the behaviour the app had before the TUI; it
// keeps headless deployment (systemd, ssh, pipes) working unchanged.
class HeadlessUi : public IUserInterface {
public:
    ~HeadlessUi() override;

    void start(SnapshotFn snapshot, CommandSink sink) override;
    void stop() override;

private:
    void inputLoop();

    CommandSink        sink_;
    std::atomic<bool>  running_{false};
    std::thread        input_thread_;
};

}  // namespace fgc
