namespace NeonSprawl.Server.Game.Mastery;
/// Read model for one player's perk state (NEO-47).
public sealed class PerkStateSnapshot(
IReadOnlyDictionary> branchPicksBySkillId,
IReadOnlySet unlockedPerkIds)
{
public static PerkStateSnapshot Empty { get; } = new(
new Dictionary>(StringComparer.Ordinal),
new HashSet(StringComparer.Ordinal));
/// skillId → tierIndex → branchId.
public IReadOnlyDictionary> BranchPicksBySkillId { get; } = branchPicksBySkillId;
public IReadOnlySet UnlockedPerkIds { get; } = unlockedPerkIds;
public bool TryGetBranchPick(string skillId, int tierIndex, out string branchId)
{
branchId = string.Empty;
if (!BranchPicksBySkillId.TryGetValue(skillId, out var tiers))
{
return false;
}
return tiers.TryGetValue(tierIndex, out branchId!);
}
}