using ZB.MOM.WW.OtOpcUa.Core.Abstractions;
namespace LeanContext;
///
/// LEAN globals type for the memory probe. Its transitive reference closure is only
/// {LeanContext, Core.Abstractions} — deliberately NO Roslyn — so the per-script cost
/// of the Roslyn reference-manager loading the globalsType's closure (dotnet/roslyn#22219)
/// can be measured against the heavy VirtualTagContext, whose closure pulls in
/// Microsoft.CodeAnalysis.CSharp.Scripting.
///
/// returns the same type that
/// VirtualTagContext.GetTag returns, so the probe's script source
/// (ctx.GetTag("x").Value) is byte-identical for both modes — the ONLY
/// difference is which assembly closure the globalsType lives in.
///
///
public sealed class LeanCtx
{
private readonly System.Collections.Generic.Dictionary _d = new();
public DataValueSnapshot GetTag(string p) =>
_d.TryGetValue(p, out var v) ? v : new DataValueSnapshot(null, 0u, null, default);
}
///
/// LEAN analogue of the prod ScriptGlobals<TContext> wrapper: exposes a
/// named ctx property so the script source can be byte-identical to the heavy
/// path (ctx.GetTag(...).Value). Lives in the LeanContext assembly, so its
/// reference closure is {LeanContext, Core.Abstractions} — NO Roslyn. This is the A0
/// "globals type in a lean assembly" treatment.
///
public sealed class LeanGlobals
{
public LeanCtx ctx { get; set; } = new();
}