{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/amigo/main/json-schema/amigo-operator-response-schema.json",
  "title": "OperatorResponse",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amigo-operators-api-openapi.yml#/components/schemas/OperatorResponse",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "title": "Id"
    },
    "workspace_id": {
      "type": "string",
      "format": "uuid",
      "title": "Workspace Id"
    },
    "name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Name",
      "description": "Display name"
    },
    "email": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Email",
      "description": "Contact email"
    },
    "type": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "clinical",
            "administrative",
            "crisis_counselor"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Type",
      "description": "Operator specialization"
    },
    "skills": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Skills",
      "description": "Skill tags for routing"
    },
    "connection_method": {
      "type": "string",
      "enum": [
        "browser",
        "phone"
      ],
      "title": "Connection Method",
      "description": "How the operator connects to calls"
    },
    "phone_number": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Phone Number",
      "description": "E.164 phone number for phone-based operators"
    },
    "role": {
      "type": "string",
      "enum": [
        "operator",
        "supervisor",
        "admin"
      ],
      "title": "Role",
      "description": "Permission role"
    },
    "status": {
      "type": "string",
      "enum": [
        "online",
        "busy",
        "offline"
      ],
      "title": "Status",
      "description": "Current availability"
    },
    "last_status_change": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Last Status Change",
      "description": "ISO-8601 timestamp of last status transition"
    },
    "active_call_sid": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Active Call Sid",
      "description": "Call SID if currently on a call"
    },
    "total_escalations_handled": {
      "type": "integer",
      "title": "Total Escalations Handled",
      "description": "Lifetime escalation count"
    },
    "avg_handle_time_seconds": {
      "type": "number",
      "title": "Avg Handle Time Seconds",
      "description": "Average escalation handle time in seconds"
    },
    "last_call_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Last Call At",
      "description": "ISO-8601 timestamp of last call"
    },
    "created_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Created At",
      "description": "When the operator was created"
    },
    "updated_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Updated At",
      "description": "When the operator was last updated"
    }
  },
  "type": "object",
  "required": [
    "id",
    "workspace_id",
    "skills",
    "connection_method",
    "role",
    "status",
    "total_escalations_handled",
    "avg_handle_time_seconds"
  ]
}