using System.Collections.Generic;
namespace Cthangover.Validator
{
///
/// Declarative map "scenario action → named argument → "
/// for actions whose arguments reference declared content. The runtime
/// IScenarioAction contract carries no parameter metadata, so the
/// validator keeps the knowledge here instead: each entry names one action
/// argument and the entity kind it must resolve to. Scenario validation adds
/// a graph reference per literal value (see
/// ), and
/// reports a missing declaration with the
/// exact scenario file and line — the static answer to the typo class the
/// runtime factories can only log.
///
/// The table intentionally covers only actions with literal content ids
/// today (party.add / character.send_notification /
/// character.add_skill / battle.init). Extend it when a new action starts
/// accepting content references; the mechanics need no code changes.
/// Comma-separated lists (battle.init enemies=) and runtime-computed values
/// (the ${name} marker) are supported by the caller, not here.
///
public static class ActionArgumentReferences
{
private static readonly Dictionary CharacterType = new Dictionary
{
["type"] = ValidationKind.Character,
};
private static readonly Dictionary PartyAdd = new Dictionary
{
["id"] = ValidationKind.Character,
};
private static readonly Dictionary BattleInit = new Dictionary
{
["scene"] = ValidationKind.Scene,
["enemies"] = ValidationKind.Character,
["quest_id"] = ValidationKind.Quest,
};
private static readonly Dictionary AddSkill = new Dictionary
{
["id"] = ValidationKind.Skill,
};
private static readonly Dictionary> Table =
new Dictionary>(System.StringComparer.OrdinalIgnoreCase)
{
["party.add"] = PartyAdd,
["character.send_notification"] = CharacterType,
["character.add_skill"] = AddSkill,
["battle.init"] = BattleInit,
};
///
/// Returns the argument→kind map for an action, or false when the action
/// carries no known content references. Lookup is case-insensitive to
/// match the reference check for the action name itself.
///
public static bool TryGetKinds(string actionName, out IReadOnlyDictionary kinds)
{
return Table.TryGetValue(actionName, out kinds);
}
}
}