neon-sprawl/server/NeonSprawl.Server/Game/Npc/INpcBehaviorDefinitionRegis...

24 lines
1.5 KiB
C#

using System.Diagnostics.CodeAnalysis;
namespace NeonSprawl.Server.Game.Npc;
/// <summary>
/// Read-only access to validated <see cref="NpcBehaviorDefRow"/> entries loaded at startup (<see cref="NpcBehaviorDefinitionCatalog"/>).
/// </summary>
/// <remarks>
/// <para><b>E5.M2 (NPC runtime / instance binding):</b> callers validating behavior ids and resolving aggro/telegraph metadata should depend on this interface
/// rather than <see cref="NpcBehaviorDefinitionCatalog"/> so behavior defs stay centralized.</para>
/// <para><b>NEO-90:</b> HTTP/read-model projections should depend on this interface rather than reaching into the catalog.</para>
/// </remarks>
public interface INpcBehaviorDefinitionRegistry
{
/// <summary>Attempts to resolve a behavior by stable <c>id</c> (see <c>npc-behavior-def.schema.json</c>). Unknown ids and <c>null</c> return <c>false</c> without throwing.</summary>
bool TryGetDefinition(string? behaviorId, [NotNullWhen(true)] out NpcBehaviorDefRow? definition);
/// <summary>Trims and lowercases <paramref name="rawBehaviorId"/>; returns <c>true</c> when the normalized id exists in the loaded catalog. <c>null</c>, empty, and whitespace return <c>false</c> without throwing.</summary>
bool TryNormalizeKnown(string? rawBehaviorId, [NotNullWhen(true)] out string normalized);
/// <summary>Every loaded definition, ordered by <see cref="NpcBehaviorDefRow.Id"/> (ordinal).</summary>
IReadOnlyList<NpcBehaviorDefRow> GetDefinitionsInIdOrder();
}