namespace StellaOps.AdvisoryAI.PolicyStudio; /// /// Type of policy intent. /// Sprint: SPRINT_20251226_017_AI_policy_copilot /// Task: POLICY-01 /// public enum PolicyIntentType { /// /// Override default verdict for specific conditions. /// OverrideRule, /// /// Escalate findings under specific conditions. /// EscalationRule, /// /// Define exception conditions that bypass normal rules. /// ExceptionCondition, /// /// Define precedence when multiple rules match. /// MergePrecedence, /// /// Set thresholds for automatic verdicts. /// ThresholdRule, /// /// Define scope restrictions for rules. /// ScopeRestriction } /// /// Condition in a policy rule. /// public sealed record PolicyCondition { /// /// Field to evaluate (severity, cvss_score, reachable, has_vex, etc.). /// public required string Field { get; init; } /// /// Operator (equals, greater_than, less_than, contains, in, not_in). /// public required string Operator { get; init; } /// /// Value to compare against. /// public required object Value { get; init; } /// /// Logical connector to next condition (and, or). /// public string? Connector { get; init; } } /// /// Action to take when conditions match. /// public sealed record PolicyAction { /// /// Action type (set_verdict, escalate, notify, block, allow). /// public required string ActionType { get; init; } /// /// Action parameters. /// public required IReadOnlyDictionary Parameters { get; init; } } /// /// Authority level of the policy draft. /// public enum PolicyDraftAuthority { /// /// AI suggestion requiring review. /// Suggestion, /// /// Validated draft ready for approval. /// Validated, /// /// Approved and ready for production. /// Approved } /// /// A parsed policy intent from natural language. /// Sprint: SPRINT_20251226_017_AI_policy_copilot /// Task: POLICY-04 /// public sealed record PolicyIntent { /// /// Unique intent ID. /// public required string IntentId { get; init; } /// /// Type of intent. /// public required PolicyIntentType IntentType { get; init; } /// /// Original natural language input. /// public required string OriginalInput { get; init; } /// /// Conditions for the rule. /// public required IReadOnlyList Conditions { get; init; } /// /// Actions to take when conditions match. /// public required IReadOnlyList Actions { get; init; } /// /// Scope of the rule (all, service, team, project). /// public required string Scope { get; init; } /// /// Scope identifier. /// public string? ScopeId { get; init; } /// /// Rule priority (higher = evaluated first). /// public required int Priority { get; init; } /// /// Confidence in the parsing (0.0-1.0). /// public required double Confidence { get; init; } /// /// Alternative interpretations if ambiguous. /// public IReadOnlyList? Alternatives { get; init; } /// /// Clarifying questions if ambiguous. /// public IReadOnlyList? ClarifyingQuestions { get; init; } } /// /// Result of parsing natural language to policy intent. /// public sealed record PolicyParseResult { /// /// Primary parsed intent. /// public required PolicyIntent Intent { get; init; } /// /// Whether parsing was successful. /// public required bool Success { get; init; } /// /// Error message if parsing failed. /// public string? ErrorMessage { get; init; } /// /// Model ID used for parsing. /// public required string ModelId { get; init; } /// /// Parsed timestamp. /// public required string ParsedAt { get; init; } }