{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/sagaris/json-schema/sagaris-call-detail-schema.json",
  "title": "CallDetail",
  "description": "One call with its transcript.",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/sagaris-openapi.json#/components/schemas/CallDetail",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "direction": {
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "type": [
        "string",
        "null"
      ]
    },
    "caller_phone": {
      "type": [
        "string",
        "null"
      ]
    },
    "caller_name": {
      "type": [
        "string",
        "null"
      ]
    },
    "called_number": {
      "type": [
        "string",
        "null"
      ]
    },
    "contact_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "route_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "handled_by": {
      "type": "string",
      "enum": [
        "ai_receptionist",
        "human"
      ]
    },
    "ai_outcome": {
      "type": [
        "string",
        "null"
      ]
    },
    "handoff_reason": {
      "type": [
        "string",
        "null"
      ]
    },
    "started_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "answered_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "ended_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "duration_seconds": {
      "type": [
        "integer",
        "null"
      ]
    },
    "ai_seconds": {
      "type": [
        "number",
        "null"
      ]
    },
    "recording_available": {
      "type": "boolean"
    },
    "transcript": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "speaker": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "speaker",
          "text"
        ]
      }
    }
  },
  "required": [
    "id",
    "handled_by",
    "recording_available",
    "transcript"
  ]
}