using System; namespace GmRelay.Shared.Features.Sessions.CreateSession.Wizard; /// /// Wire format for wizard callback data. The format is shared by all /// platforms (Telegram today, Discord in a follow-up task) and must /// stay stable because it is persisted in chat histories and slash-command /// autocomplete. Token is wizard to keep the namespace separate /// from the rest of the bot's command callbacks. /// public static class WizardCallbackData { public const string Prefix = "wizard"; public static string Choice(string step, string choice) => $"{Prefix}:{step}:{choice}"; public static string Back() => $"{Prefix}:back"; public static string Cancel() => $"{Prefix}:cancel"; public static string Create() => $"{Prefix}:create"; public static bool TryParse(string? data, out string action, out string step, out string choice) { action = step = choice = string.Empty; if (string.IsNullOrEmpty(data)) return false; var parts = data.Split(':', 3); if (parts.Length < 2 || parts[0] != Prefix) return false; action = parts[1]; step = parts.Length >= 3 ? parts[1] : string.Empty; choice = parts.Length >= 3 ? parts[2] : string.Empty; return true; } }