namespace Nuuru.Server.Services { public class LiveKitOptions { public string? ServerUrl { get; set; } public string? ApiUrl { get; set; } public string? ApiKey { get; set; } public string? ApiSecret { get; set; } public bool IsConfigured => !string.IsNullOrWhiteSpace(ServerUrl) && !string.IsNullOrWhiteSpace(ApiKey) && !string.IsNullOrWhiteSpace(ApiSecret); public string? GetEffectiveApiUrl() { if (!string.IsNullOrWhiteSpace(ApiUrl)) { return ApiUrl.TrimEnd('/'); } if (string.IsNullOrWhiteSpace(ServerUrl)) { return null; } if (!Uri.TryCreate(ServerUrl, UriKind.Absolute, out var uri)) { return ServerUrl.TrimEnd('/'); } var builder = new UriBuilder(uri); builder.Scheme = uri.Scheme switch { "ws" => Uri.UriSchemeHttp, "wss" => Uri.UriSchemeHttps, _ => uri.Scheme }; builder.Query = string.Empty; builder.Fragment = string.Empty; return builder.Uri.ToString().TrimEnd('/'); } } }