openapi: 3.1.0
info:
  title: TenantPilot Baseline Alert Events
  version: 1.0.0
  description: |
    Domain contract for baseline-related alert events produced during alerts evaluation.
    This repo dispatches events internally (not a public HTTP API).
paths: {}
components:
  schemas:
    AlertEventBase:
      type: object
      required: [event_type, tenant_id, severity, fingerprint_key, title, body, metadata]
      properties:
        event_type:
          type: string
        tenant_id:
          type: integer
          minimum: 1
        severity:
          type: string
          enum: [low, medium, high, critical]
        fingerprint_key:
          type: string
          minLength: 1
        title:
          type: string
        body:
          type: string
        metadata:
          type: object
          additionalProperties: true

    BaselineHighDriftEvent:
      allOf:
        - $ref: '#/components/schemas/AlertEventBase'
        - type: object
          properties:
            event_type:
              const: baseline_high_drift
            metadata:
              type: object
              required: [finding_id, finding_fingerprint, change_type]
              properties:
                finding_id:
                  type: integer
                  minimum: 1
                finding_fingerprint:
                  type: string
                  minLength: 1
                change_type:
                  type: string
                  enum: [missing_policy, different_version, unexpected_policy]

    BaselineCompareFailedEvent:
      allOf:
        - $ref: '#/components/schemas/AlertEventBase'
        - type: object
          properties:
            event_type:
              const: baseline_compare_failed
            severity:
              const: high
            metadata:
              type: object
              required: [operation_run_id]
              properties:
                operation_run_id:
                  type: integer
                  minimum: 1
