namespace AcDream.UI.Abstractions;
///
/// Maps a to the legacy ChatChannel
/// bitflag id used by the 0x0147 ChatChannel GameAction. Ported from
/// holtburger's resolve_legacy_channel
/// (references/holtburger/crates/holtburger-core/src/client/commands.rs
/// lines 50-62) cross-referenced against the ChatChannel enum
/// (references/holtburger/crates/holtburger-protocol/src/messages/chat/types.rs
/// lines 8-24) for the actual numeric ids.
///
///
/// Returns null for non-legacy kinds (Say, Tell, Unknown, and the
/// Turbine-routed General/Trade/etc.) — those callers handle dispatch
/// themselves. rides Talk (0x0015) and
/// rides Tell (0x005D); the Turbine
/// channels need TurbineChat wiring not yet in place (Phase I.6).
///
///
public static class ChannelResolver
{
/// Result of a successful legacy-channel resolution.
public readonly record struct Resolved(uint ChannelId, string DisplayName);
///
/// Resolve to a legacy ChatChannel id + a
/// human-readable display name for chat-log echo. Returns null
/// for non-legacy kinds; the caller routes those separately.
///
public static Resolved? Resolve(ChatChannelKind kind) => kind switch
{
// ChatChannel values from holtburger-protocol/src/messages/chat/types.rs:
// Fellow = 0x00000800
// Vassals = 0x00001000
// Patron = 0x00002000
// Monarch = 0x00004000
// CoVassals = 0x01000000
// AllegianceBroadcast = 0x02000000
ChatChannelKind.Fellowship => new Resolved(0x00000800u, "Fellowship"),
ChatChannelKind.Allegiance => new Resolved(0x02000000u, "Allegiance"),
ChatChannelKind.Vassals => new Resolved(0x00001000u, "Vassals"),
ChatChannelKind.Patron => new Resolved(0x00002000u, "Patron"),
ChatChannelKind.Monarch => new Resolved(0x00004000u, "Monarch"),
ChatChannelKind.CoVassals => new Resolved(0x01000000u, "CoVassals"),
_ => null,
};
}