#pragma once
// Spec: SPEC.md UX-HOST-01. The application contract the host drives each frame.
#include <cstdint>
#include <string>
#include "ui/View.hpp"
namespace dp::ui {
class App {
public:
virtual ~App() = default;
// Called every frame with the logical window size; returns the whole UI tree.
virtual ViewPtr body(Size window) = 0;
// Dark appearance for this frame (system, light or dark resolved by the app).
virtual bool dark(bool systemDark) { return systemDark; }
// Window-level keys (Escape, Ctrl+R ...). Return true when consumed.
virtual bool onKeyDown(std::uint32_t /*sdlKey*/, std::uint16_t /*mods*/) { return false; }
// The window became active again (scene phase .active).
virtual void onForeground() {}
// Safe-area insets simulated for the window (spec/Layout.hpp).
virtual Insets safeArea(Size /*window*/) { return {}; }
// Window title (unread badge equivalent); empty keeps the current title.
virtual std::string windowTitle() { return ""; }
// True while network or timers still change what is on screen (headless capture waits on this).
virtual bool busy() { return false; }
};
} // namespace dp::ui