{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/roark/json-schema/roark-issue-schema.json",
  "title": "Issue",
  "description": "An issue surfaced on the Roark Issues page",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/roark-issue-api-openapi.yml#/components/schemas/Issue",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "organizationId": {
      "type": "string",
      "format": "uuid"
    },
    "projectId": {
      "type": "string",
      "format": "uuid"
    },
    "alertId": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "Only set when source is an alert"
    },
    "source": {
      "type": "string",
      "enum": [
        "TREND_ALERT",
        "SINGLE_CALL_ALERT",
        "TRACE_FAILURE",
        "MANUAL",
        "API",
        "AGENT"
      ],
      "description": "Who opened the issue"
    },
    "title": {
      "type": "string"
    },
    "summary": {
      "type": [
        "string",
        "null"
      ]
    },
    "severity": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "LOW",
        "MEDIUM",
        "HIGH",
        "CRITICAL"
      ],
      "description": "Coarse priority — LOW / MEDIUM / HIGH / CRITICAL"
    },
    "status": {
      "type": "string",
      "enum": [
        "OPEN",
        "ACKED",
        "RESOLVED"
      ],
      "description": "Lifecycle state"
    },
    "fingerprint": {
      "type": "string",
      "description": "Producer-supplied dedup key. Same fingerprint coalesces into the same issue."
    },
    "eventCount": {
      "type": "integer",
      "description": "How many times this issue has been observed."
    },
    "lastEventAt": {
      "type": [
        "string",
        "null"
      ],
      "description": "Timestamp of the most recent occurrence, or null if no events yet."
    },
    "openedAt": {
      "type": "string"
    },
    "resolvedAt": {
      "type": [
        "string",
        "null"
      ]
    },
    "assigneeUserId": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "evidence": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/IssueEvidence"
      },
      "description": "Calls / chats attached as evidence"
    },
    "createdAt": {
      "type": "string"
    },
    "updatedAt": {
      "type": [
        "string",
        "null"
      ]
    }
  },
  "required": [
    "id",
    "organizationId",
    "projectId",
    "alertId",
    "source",
    "title",
    "summary",
    "severity",
    "status",
    "fingerprint",
    "eventCount",
    "lastEventAt",
    "openedAt",
    "resolvedAt",
    "assigneeUserId",
    "evidence",
    "createdAt",
    "updatedAt"
  ],
  "$defs": {
    "IssueEvidence": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "callId": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "description": "Call attached as evidence, or null"
        },
        "chatId": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "description": "Chat attached as evidence, or null"
        },
        "observedAt": {
          "type": "string",
          "description": "When the evidence was observed (ISO-8601)"
        }
      },
      "required": [
        "id",
        "callId",
        "chatId",
        "observedAt"
      ]
    }
  }
}