using NeonSprawl.Server.Game.Mastery;

namespace NeonSprawl.Server.Game.Skills;

/// <summary>
/// NEO-43: E7.M2 mission/quest reward apply should call <see cref="GrantFromMissionReward"/> so XP uses the same path as
/// <c>POST …/skill-progression</c>. Outcome is ignored on success paths (mirror NEO-42); use
/// <see cref="SkillProgressionGrantOperations.TryApplyGrant"/> directly when callers need deny envelopes.
/// </summary>
public static class MissionRewardSkillXpGrant
{
    /// <summary>Applies one grant with <c>sourceKind: mission_reward</c> if the catalog allowlist permits it.</summary>
    /// <remarks>Pass a normalized <paramref name="playerId"/> (e.g. route-trimmed), matching other grant hook callers.</remarks>
    public static void GrantFromMissionReward(
        string playerId,
        string skillId,
        int amount,
        ISkillDefinitionRegistry registry,
        IPlayerSkillProgressionStore xpStore,
        ISkillLevelCurve levelCurve,
        PerkUnlockEngine perkUnlockEngine)
    {
        _ = SkillProgressionGrantOperations.TryApplyGrant(
            playerId,
            skillId,
            amount,
            MissionRewardSkillXpConstants.MissionRewardSourceKind,
            registry,
            xpStore,
            levelCurve,
            perkUnlockEngine);
    }
}
