#pragma once #include #include namespace Echoion::Api { // Opaque handle types to avoid including full headers // These are used in interfaces to break dependencies // Forward declarations for Core types (Plugin never needs full definition) struct AppConfig; struct HotReloadState; struct PlaybackState; struct TrackInfo; struct QueueEntry; // Opaque handle wrapper - type-safe void pointer replacement template class OpaqueHandle { public: OpaqueHandle() = default; explicit OpaqueHandle(std::shared_ptr ptr) : ptr_(std::move(ptr)) { } [[nodiscard]] bool isValid() const { return ptr_ != nullptr; } [[nodiscard]] T* get() const { return ptr_.get(); } [[nodiscard]] T& operator*() const { return *ptr_; } [[nodiscard]] T* operator->() const { return ptr_.get(); } void reset() { ptr_.reset(); } void reset(T* ptr) { ptr_.reset(ptr); } [[nodiscard]] std::shared_ptr toSharedPtr() const { return ptr_; } private: std::shared_ptr ptr_; }; // Specific handle types using AppConfigHandle = OpaqueHandle; using HotReloadStateHandle = OpaqueHandle; using PlaybackStateHandle = OpaqueHandle; using TrackInfoHandle = OpaqueHandle; using QueueEntryHandle = OpaqueHandle; // Serialization helpers for cross-boundary communication using SerializedConfig = std::string; // JSON string using SerializedState = std::string; // JSON string } // namespace Echoion::Api