#pragma once #include "TrackTypes.hpp" #include "RpcTypes.hpp" #include #include #include #include #include namespace Echoion::Core { using namespace Echoion::Api; // State V0 - Initial version (placeholder for testing migration) struct StateV0 { std::vector trackIds; float volume = 0.5f; }; // State V1 - Current version with full playback state struct StateV1 { // Playback state struct PlaybackState { TrackInfo currentTrack; int64_t positionMs = 0; // Use int64 for JSON compatibility bool isPlaying = false; bool isPaused = false; float volume = 0.5f; bool shuffle = false; bool repeat = false; }; // Queue entry with metadata struct QueueEntryState { TrackInfo track; uint64_t queueId = 0; std::string addedBy; std::string addedAt; // ISO 8601 }; // Session state for RPC clients struct SessionState { uint64_t clientId = 0; std::string authToken; std::string lastActivity; // ISO 8601 }; struct ExtensionPluginState { std::string name; std::string json; std::uint32_t version = 0; }; // Main state PlaybackState playback; bool hasPlayback = false; // Flag to indicate if playback state is valid bool autoplay = false; // Radio mode on/off (persisted for restart) std::vector queue; std::vector sessions; std::vector extensionPlugins; // Version info uint32_t version = 1; std::string savedAt; // ISO 8601 }; } // namespace Echoion::Core // StateV0/StateV1 (and the nested PlaybackState/QueueEntryState/SessionState) // are plain reflectable aggregates whose member names are the desired JSON // keys, so Void::Json reflection serializes them with no annotations. The only // non-reflectable member is TrackInfo, which supplies its own // to_json()/from_json() in TrackTypes.hpp.