using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace DysonNetwork.Sphere.Chat.Realtime;
/// 
/// Interface for real-time communication services (like Cloudflare, Agora, Twilio, etc.)
/// 
public interface IRealtimeService
{
    /// 
    /// Service provider name
    /// 
    string ProviderName { get; }
    
    /// 
    /// Creates a new real-time session
    /// 
    /// The room identifier
    /// Additional metadata to associate with the session
    /// Session configuration data
    Task CreateSessionAsync(Guid roomId, Dictionary metadata);
    
    /// 
    /// Ends an existing real-time session
    /// 
    /// The session identifier
    /// The session configuration
    Task EndSessionAsync(string sessionId, RealtimeSessionConfig config);
    /// 
    /// Gets a token for user to join the session
    /// 
    /// The user identifier
    /// The session identifier
    /// The user is the admin of session
    /// User-specific token for the session
    string GetUserToken(Guid accountId, string accountName, string sessionId, bool isAdmin = false);
    
    /// 
    /// Processes incoming webhook requests from the realtime service provider
    /// 
    /// The webhook request body content
    /// The authentication header value
    /// Task representing the asynchronous operation
    Task ReceiveWebhook(string body, string authHeader);
    
}
/// 
/// Common configuration object for real-time sessions
/// 
public class RealtimeSessionConfig
{
    /// 
    /// Service-specific session identifier
    /// 
    public string SessionId { get; set; } = null!;
    
    /// 
    /// Additional provider-specific configuration parameters
    /// 
    public Dictionary Parameters { get; set; } = new();
}