using System.Text.Json; using System.Threading; namespace GB5Shared.DTO.Qualifier { /// /// Execution context passed through every qualifier in a stage run. /// A single context instance is shared across all qualifiers in one execution, /// so each qualifier can read facts set by earlier qualifiers (L1 cache). /// public sealed class QualifierExecutionContext { /// Tenant identifier (populated from LoginDTO.TenantId). public int ClientId { get; init; } /// Primary key of the entity being evaluated (e.g. GopExecutionId). public int EntityId { get; init; } /// Entity type code matching MQUALIFIERENTITY.ENTITYCODE (e.g. "GOPEXECUTION"). public string EntityCode { get; init; } = string.Empty; /// Execution stage — tinyint, matches MQUALIFIERENTITY.STAGE. public byte Stage { get; init; } /// Execution scope — tinyint, matches MQUALIFIERENTITY.SCOPE. public byte Scope { get; init; } /// /// The source document provided by the caller. /// Qualifiers read field values from this document via JSONPath. /// public JsonDocument? Document { get; init; } /// /// Shared fact store for this execution. /// Qualifiers write outputs here; downstream qualifiers and the mapping engine read from it. /// public QualifierFactBag Facts { get; init; } = new(); /// Correlation ID for tracing a single execution across all qualifiers. public string CorrelationId { get; init; } = string.Empty; public CancellationToken CancellationToken { get; init; } } }