namespace RelayShared.Services;
///
/// One row in the sidebar channel list. The server computes the permission-derived fields
/// (CanPost, CanManage) per-user so the client never has to evaluate permissions itself.
///
public sealed class ChannelItem
{
/// Surreal record id (e.g. "channels:abc").
public string ChannelId { get; set; } = string.Empty;
/// Sidebar display name ("general", "welcome", etc.).
public string Name { get; set; } = string.Empty;
/// Drives icon and behavior: Text/Voice/File/Forum/Stage.
public ChannelType Type { get; set; }
/// Sidebar category label (e.g. "General"). Empty groups fall under a default "Channels" header.
public string Group { get; set; } = string.Empty;
/// Creation timestamp. Drives sidebar sort order (oldest → newest).
public DateTime CreatedAt { get; set; }
/// True if the channel is announcement-style (welcome, files). Drives the 🔒 suffix in the sidebar.
public bool IsReadOnly { get; set; }
/// Permission-resolved: can the receiving user send messages here. Drives input enable/disable.
public bool CanPost { get; set; }
/// Permission-resolved: can the receiving user edit/delete this channel. Drives context-menu visibility.
public bool CanManage { get; set; }
}
///
/// Server-to-client channel list. Sent in response to WsAction.GetChannels and broadcast
/// to all sessions after every channel create / delete.
///
public sealed class SocketChannelList
{
public SignalType Type { get; set; } = SignalType.ChannelList;
/// Channels the receiving user is allowed to view. Permission filtering happens server-side.
public List Channels { get; set; } = [];
}