{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/secure-flows-com/json-schema/secure-flows-com-workspace-audit-event-page-response-schema.json",
  "title": "WorkspaceAuditEventPageResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/secure-flows-com-audit-api-openapi.yml#/components/schemas/WorkspaceAuditEventPageResponse",
  "type": "object",
  "required": [
    "items",
    "page",
    "pageSize",
    "totalItems",
    "totalPages"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/WorkspaceAuditEventView"
      }
    },
    "page": {
      "type": "integer"
    },
    "pageSize": {
      "type": "integer"
    },
    "totalItems": {
      "type": "integer",
      "format": "int64"
    },
    "totalPages": {
      "type": "integer"
    }
  },
  "$defs": {
    "WorkspaceAuditEventView": {
      "type": "object",
      "required": [
        "id",
        "eventType",
        "occurredAt"
      ],
      "properties": {
        "id": {
          "type": "integer",
          "format": "int64"
        },
        "eventType": {
          "type": "string",
          "description": "High-level category, e.g. `SESSION_CREATED`, `USER_CREATED`, `USER_LOGIN`, `SESSION_KEY_WRITTEN`,\n`BILLING_PLAN_CHANGED`, `BILLING_OVERRIDE_UPDATED`, `BILLING_SESSION_LIMIT_EXCEEDED`,\n`BILLING_PAYLOAD_LIMIT_EXCEEDED`, `BILLING_CANCEL_REQUESTED`, `BILLING_RESUME_REQUESTED`,\n`BILLING_GRACE_LOCK_ENTERED`, `BILLING_GRACE_WIPE`.\n"
        },
        "occurredAt": {
          "type": "string",
          "format": "date-time"
        },
        "sessionRowId": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int64",
          "description": "Internal session id when the event is session-scoped"
        },
        "sessionUserIdentifier": {
          "type": [
            "string",
            "null"
          ],
          "description": "Firebase UID for the session subject user (fallback when email is absent)"
        },
        "sessionUserEmail": {
          "type": [
            "string",
            "null"
          ],
          "description": "Email from the workspace user row when set (best-effort from Firebase on login/session flows).\nAudit UIs should prefer this over `sessionUserIdentifier`.\n"
        },
        "sessionAppId": {
          "type": [
            "string",
            "null"
          ]
        },
        "sessionStatus": {
          "type": [
            "string",
            "null"
          ],
          "description": "active, expired, or revoked when session row exists"
        },
        "actorProviderUid": {
          "type": [
            "string",
            "null"
          ]
        },
        "actorDisplayName": {
          "type": [
            "string",
            "null"
          ]
        },
        "actorEmail": {
          "type": [
            "string",
            "null"
          ],
          "description": "Actor email when known; prefer over `actorProviderUid` in UIs"
        },
        "metadataJson": {
          "type": [
            "string",
            "null"
          ],
          "description": "Event-specific JSON metadata (no session payload). For billing limit events, includes\n`code` (`BILLING_SESSION_LIMIT` or `BILLING_PAYLOAD_LIMIT`), `planLimit`, `observedValue`,\nand optional `appId`.\n"
        }
      }
    }
  }
}