namespace NeonSprawl.Server.Game.Skills;

/// <summary>Persisted totals of skill XP per player (NEO-38); level is derived, not stored.</summary>
public interface IPlayerSkillProgressionStore
{
    /// <summary>Keyed by catalog <c>SkillDef.id</c>; omitted skills imply XP 0.</summary>
    IReadOnlyDictionary<string, int> GetXpTotals(string playerId);

    /// <summary>
    /// Adds <paramref name="amount"/> to <paramref name="skillId"/> for <paramref name="playerId"/>.
    /// Returns <c>false</c> when the player cannot be written (e.g. in-memory store has no bucket; Postgres player missing from <c>player_position</c>).
    /// </summary>
    bool TryApplyXpDelta(string playerId, string skillId, int amount, out int previousXp, out int newXp);

    /// <summary>Sets absolute XP for one skill (NEO-48 dev fixture API). <paramref name="xp"/> must be &gt;= 0.</summary>
    bool TrySetSkillXpTotal(string playerId, string skillId, int xp);

    /// <summary>Sets absolute XP for multiple skills atomically (NEO-48 dev fixture API).</summary>
    bool TrySetSkillXpTotals(string playerId, IReadOnlyDictionary<string, int> skillXpTotals);
}
