// Discriminated result — allows tests and callers to assert the exact outcome
// without inspecting PostgreSQL or Redis directly.
public record QsofaResult(QsofaOutcome Outcome, int ActiveCriteria = 0)
{
    public static readonly QsofaResult NotQsofaCode       = new(QsofaOutcome.NotQsofaCode);
    public static readonly QsofaResult AlertCreated     = new(QsofaOutcome.AlertCreated);
    public static readonly QsofaResult AlertAlreadyOpen   = new(QsofaOutcome.AlertAlreadyOpen);

    public static QsofaResult InsufficientCriteria(int count) =>
        new(QsofaOutcome.InsufficientCriteria, count);
}
