namespace ControlCenter.Models;

/// <summary>
/// Defines which side of the Control Center dashboard a minion occupies.
/// </summary>
public enum MinionSide
{
    /// <summary>Development side — Rex, Dex, Hex.</summary>
    Dev,

    /// <summary>Business side — Larry, Mel, Buzz.</summary>
    Business
}

/// <summary>
/// Visual state of a minion sprite, derived from the agent's
/// <see cref="AgentStatus"/>. Maps Active/Idle/Thinking/Error
/// to frontend animation states.
/// </summary>
public enum MinionState
{
    /// <summary>Agent is actively processing — minion shows working animation.</summary>
    Active,

    /// <summary>Agent is idle — minion shows idle/patrolling animation.</summary>
    Idle,

    /// <summary>Agent is thinking (LLM call in flight) — minion shows thinking animation.</summary>
    Thinking,

    /// <summary>Agent encountered an error — minion shows error/distress animation.</summary>
    Error
}

/// <summary>
/// Static mapping entry that associates an agent ID with a minion's
/// display side and position index within that side.
///
/// <para>Position indices are zero-based within each side. The dev side
/// has Rex at 0, Dex at 1, and Hex at 2. The business side has
/// Larry at 0, Mel at 1, and Buzz at 2.</para>
/// </summary>
/// <param name="AgentId">Agent identifier, e.g. "rex", "dex".</param>
/// <param name="Side">Which side of the dashboard the minion occupies.</param>
/// <param name="PositionIndex">Zero-based position index within the side.</param>
/// <param name="DisplayName">Human-readable name, e.g. "Rex".</param>
public record AgentMinionMapping(
    string AgentId,
    MinionSide Side,
    int PositionIndex,
    string DisplayName
);

/// <summary>
/// Real-time minion state update pushed to SignalR clients
/// when an agent's status changes. Combines the static mapping
/// (who/where) with the dynamic state (what the minion is doing).
/// </summary>
/// <param name="AgentId">Agent identifier, e.g. "rex".</param>
/// <param name="DisplayName">Human-readable minion name, e.g. "Rex".</param>
/// <param name="Side">Which side of the dashboard — Dev or Business.</param>
/// <param name="PositionIndex">Position within the side (0-based).</param>
/// <param name="State">Current minion animation state.</param>
/// <param name="Timestamp">ISO 8601 timestamp of the state change.</param>
public record MinionStateUpdate(
    string AgentId,
    string DisplayName,
    MinionSide Side,
    int PositionIndex,
    MinionState State,
    string Timestamp
);