{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/shapelessai/json-schema/shapelessai-connection-list-schema.json",
  "title": "ConnectionList",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/shapelessai-connections-api-openapi.yml#/components/schemas/ConnectionList",
  "type": "object",
  "properties": {
    "connections": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Connection"
      }
    },
    "connect": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ConnectLinkCreated"
      },
      "description": "One link per platform with no live account: hand it to the human, they click, the account appears here."
    }
  },
  "$defs": {
    "ConnectLinkCreated": {
      "type": "object",
      "properties": {
        "platform": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "Hand this to the human; opens in a browser."
        },
        "expiresAt": {
          "type": "string",
          "format": "date-time"
        },
        "open": {
          "type": "string",
          "description": "What to tell the human."
        }
      },
      "required": [
        "platform",
        "url",
        "expiresAt"
      ]
    },
    "Connection": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "platform": {
          "type": "string"
        },
        "handle": {
          "type": "string"
        },
        "displayName": {
          "type": [
            "string",
            "null"
          ]
        },
        "avatarUrl": {
          "type": [
            "string",
            "null"
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "active",
            "expired"
          ]
        },
        "mode": {
          "type": "string",
          "enum": [
            "oauth",
            "tracked"
          ],
          "description": "tracked = handle only, cannot publish."
        },
        "queue": {
          "$ref": "#/$defs/QueueConfig"
        },
        "reconnect": {
          "$ref": "#/$defs/ConnectLinkCreated",
          "description": "Expired grants only: the link the human opens to reconnect."
        }
      }
    },
    "QueueConfig": {
      "type": "object",
      "properties": {
        "slots": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
          },
          "minItems": 1,
          "maxItems": 12
        },
        "timezone": {
          "type": "string",
          "description": "IANA zone the slots are written in."
        }
      },
      "required": [
        "slots",
        "timezone"
      ]
    }
  }
}