#pragma once #include #include #include #include #include namespace Echoion::Core { // Configuration loader for JSON config files (internal to Core). // // Api::AppConfig is serialized directly through Void::Json reflection — // no mirror DTOs. The on-disk shape follows the domain types: durations // are strings ("30000ms"), enums are names ("High"), the proxy is a // nested object (or null), and time_points are duration strings. class ConfigLoader { public: // Load configuration from JSON file [[nodiscard]] static Api::Result loadFromFile(const std::filesystem::path& path); // Parse, migrate, and normalize a complete JSON configuration. This // is shared by file loading and live configuration updates so // legacy fields have identical behavior through both entry points. [[nodiscard]] static Api::Result loadFromJson(std::string_view json); // Save configuration to JSON file [[nodiscard]] static Api::Result saveToFile(const std::filesystem::path& path, const Api::AppConfig& config); // Get default configuration path [[nodiscard]] static std::filesystem::path getDefaultConfigPath(); // Create default configuration [[nodiscard]] static Api::AppConfig createDefaultConfig(); // Clamp/normalize values that carry hard limits after loading // (e.g. the yt-dlp concurrency cap). Applied by all load/update // paths. static void normalize(Api::AppConfig& config); }; } // namespace Echoion::Core