namespace NeonSprawl.Server.Game.Gigs;

/// <summary>
/// NEO-44: combat encounter defeat grants gig XP on the prototype main gig only — not E2.M2 skill XP.
/// Outcome is ignored on the cast accept path (best-effort apply); inspect store/GET when verification matters.
/// </summary>
public static class CombatDefeatGigXpGrant
{
    /// <summary>Applies one combat-defeat grant to the prototype main gig when <paramref name="playerId"/> is writable.</summary>
    public static void GrantOnCombatDefeat(
        string playerId,
        IPlayerGigProgressionStore gigStore,
        ILogger? logger = null)
    {
        if (!gigStore.TryApplyXpDelta(
                playerId,
                GigProgressionConstants.PrototypeMainGigId,
                GigProgressionConstants.CombatDefeatXpAmount,
                out _,
                out _))
        {
            logger?.LogDebug(
                "Combat defeat gig XP grant skipped for player {PlayerId} (store write failed)",
                playerId);
        }
    }
}
