Framework/GameAction.cs

Immutable value type representing a game UI action/button offered to the current player. It stores an action id, label, styling flags (Primary, Disabled), optional keybind, group, icon, a numeric Amount and a Variable flag for caller-supplied amounts.

namespace CardGames;

/// <summary>
/// A button the game offers the current player (e.g. "Hit", "Draw"). A game returns the set it
/// allows right now from <see cref="CardGame.ActionsFor"/>; the HUD renders one button per action
/// and calls <see cref="CardGame.SendAction"/> with the <see cref="Id"/>.
/// </summary>
/// <param name="Id">The action sent to the host.</param>
/// <param name="Label">The button caption.</param>
/// <param name="Primary">Marks the recommended/headline action - the HUD gives it the red accent.</param>
/// <param name="Key">Optional keybind label shown as a chip on the button (display only for now).</param>
/// <param name="Group">Consecutive actions sharing a non-empty group render as one connected button cluster (e.g. chips, undo/redo).</param>
/// <param name="Icon">Optional Material Icons ligature (e.g. "undo"). Rendered as a glyph before the label, or icon-only when the label is empty.</param>
/// <param name="Disabled">Shown greyed out and not clickable - keeps a button in place when it's temporarily unavailable.</param>
/// <param name="Amount">Optional numeric payload carried with the action (e.g. a chip value). Several buttons can share one <see cref="Id"/> and differ only by <see cref="Amount"/>; the host hands the matched action back so the game reads it without parsing the id.</param>
/// <param name="Variable">The <see cref="Amount"/> is supplied by the caller, not fixed (e.g. a no-limit raise). The host validates it by <see cref="Id"/> only and passes the caller's amount through; the default action bar skips it, since it needs bespoke UI (a slider) to pick the amount.</param>
public readonly record struct GameAction( string Id, string Label, bool Primary = false, string Key = null, string Group = null, string Icon = null, bool Disabled = false, long Amount = 0, bool Variable = false );