{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/logbrew/json-schema/logbrew-native-log-page-response-schema.json",
  "title": "NativeLogPageResponse",
  "description": "Opt-in cursor page for native logs.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/logbrew-logs-api-openapi.yml#/components/schemas/NativeLogPageResponse",
  "properties": {
    "logs": {
      "description": "Native log rows in newest-first order.",
      "items": {
        "$ref": "#/$defs/NativeLogResponse"
      },
      "type": "array"
    },
    "next_cursor": {
      "anyOf": [
        {
          "$ref": "#/$defs/NativeLogCursorResponse"
        },
        {
          "type": "null"
        }
      ],
      "description": "Exclusive continuation cursor when another page exists."
    }
  },
  "required": [
    "logs",
    "next_cursor"
  ],
  "type": "object",
  "$defs": {
    "CorrelatedTelemetryNextActionCode": {
      "description": "Stable correlation-aware investigation action code.",
      "oneOf": [
        {
          "const": "inspect_trace",
          "description": "Inspect the correlated distributed trace.",
          "type": "string"
        },
        {
          "const": "inspect_related_logs",
          "description": "Inspect logs related by project, release, service, and environment.",
          "type": "string"
        }
      ]
    },
    "CorrelatedTelemetryNextActionResponse": {
      "description": "Correlation-aware next action shared by issues, logs, and product actions.",
      "properties": {
        "code": {
          "$ref": "#/$defs/CorrelatedTelemetryNextActionCode",
          "description": "Stable action code."
        },
        "target": {
          "$ref": "#/$defs/CorrelatedTelemetryNextActionTarget",
          "description": "Stable action target."
        }
      },
      "required": [
        "code",
        "target"
      ],
      "type": "object"
    },
    "CorrelatedTelemetryNextActionTarget": {
      "description": "Stable correlation-aware investigation target.",
      "oneOf": [
        {
          "const": "trace_summary",
          "description": "Privacy-safe trace summary endpoint.",
          "type": "string"
        },
        {
          "const": "telemetry_logs",
          "description": "Native telemetry logs endpoint.",
          "type": "string"
        }
      ]
    },
    "NativeLogCursorResponse": {
      "description": "Exclusive continuation cursor for a native log page.",
      "properties": {
        "id": {
          "description": "ID of the last returned log row.",
          "format": "uuid",
          "type": "string"
        },
        "time": {
          "description": "Timestamp of the last returned log row.",
          "format": "date-time",
          "type": "string"
        }
      },
      "required": [
        "time",
        "id"
      ],
      "type": "object"
    },
    "NativeLogResponse": {
      "description": "A native log row returned to API clients.",
      "properties": {
        "attributes": {
          "description": "Structured log attributes."
        },
        "environment": {
          "description": "Deployment environment.",
          "type": "string"
        },
        "id": {
          "description": "Unique log row identifier.",
          "format": "uuid",
          "type": "string"
        },
        "level": {
          "description": "Canonical log level retained for compatibility with existing clients.",
          "type": "string"
        },
        "message": {
          "description": "Log message.",
          "type": "string"
        },
        "next_action": {
          "$ref": "#/$defs/CorrelatedTelemetryNextActionResponse",
          "default": {
            "code": "inspect_related_logs",
            "target": "telemetry_logs"
          },
          "description": "Correlation-aware next investigation action."
        },
        "occurred_at": {
          "description": "Log occurrence timestamp.",
          "format": "date-time",
          "type": "string"
        },
        "project_id": {
          "description": "Owning project ID.",
          "format": "uuid",
          "type": "string"
        },
        "release": {
          "description": "Application release.",
          "type": "string"
        },
        "sdk_name": {
          "default": "",
          "description": "SDK package name that emitted the log.",
          "type": "string"
        },
        "sdk_version": {
          "default": "",
          "description": "SDK semantic version that emitted the log.",
          "type": "string"
        },
        "service_name": {
          "description": "Logical service name.",
          "type": "string"
        },
        "severity": {
          "description": "Canonical user-facing severity: `info`, `warning`, `error`, or `critical`.",
          "type": "string"
        },
        "source": {
          "description": "Log source.",
          "type": "string"
        },
        "span_id": {
          "default": null,
          "description": "Exact span identifier within the distributed trace.",
          "type": [
            "string",
            "null"
          ]
        },
        "trace_id": {
          "description": "Distributed trace identifier.",
          "type": [
            "string",
            "null"
          ]
        },
        "triage": {
          "anyOf": [
            {
              "$ref": "#/$defs/SignalTriageResponse"
            },
            {
              "type": "null"
            }
          ],
          "description": "Reversible user triage. `severity` remains the immutable captured value."
        }
      },
      "required": [
        "id",
        "project_id",
        "level",
        "severity",
        "source",
        "message",
        "attributes",
        "occurred_at",
        "environment",
        "release",
        "trace_id",
        "span_id",
        "service_name",
        "sdk_name",
        "sdk_version",
        "next_action"
      ],
      "type": "object"
    },
    "SignalTriageResponse": {
      "description": "User-owned presentation rule layered over immutable captured telemetry.",
      "properties": {
        "effective_severity": {
          "description": "Effective presentation severity after applying an optional user override.",
          "type": "string"
        },
        "ignored": {
          "description": "Whether the signal is excluded from the active view.",
          "type": "boolean"
        },
        "rule_applied": {
          "description": "Whether a non-default rule currently applies.",
          "type": "boolean"
        }
      },
      "required": [
        "effective_severity",
        "ignored",
        "rule_applied"
      ],
      "type": "object"
    }
  }
}