namespace NeonSprawl.Server.Game.Quests;
/// Id normalization for player quest progress stores (NEO-116).
public static class QuestProgressIds
{
/// Trim + lowercase; empty when input is null/whitespace.
public static string NormalizePlayerId(string? playerId)
{
var trimmed = playerId?.Trim();
if (string.IsNullOrEmpty(trimmed))
{
return string.Empty;
}
return trimmed.ToLowerInvariant();
}
/// Trim + lowercase; empty when input is null/whitespace.
public static string NormalizeQuestId(string? questId) => NormalizePlayerId(questId);
/// Trim + lowercase; empty when input is null/whitespace.
public static string NormalizeObjectiveId(string? objectiveId) => NormalizePlayerId(objectiveId);
/// Composite store key for + .
public static string MakeProgressKey(string? playerId, string? questId)
{
var p = NormalizePlayerId(playerId);
var q = NormalizeQuestId(questId);
if (p.Length == 0 || q.Length == 0)
{
return string.Empty;
}
return $"{p}\0{q}";
}
}