{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://parlane.ai/spec/attachment.schema.json",
  "title": "Attachment",
  "description": "An attachment sent in POST /chat (REST) or delivered to a share.tool in an action. Supports screenshots, images, text, office documents, and PDFs. v1 caps decoded size at 10 MB per attachment (raisable post-v1). Exactly one of `data` (base64) or `url` (https) must be present. See docs/06-integration-kit.md §8.",
  "type": "object",
  "additionalProperties": false,
  "required": ["kind", "mime"],
  "properties": {
    "kind": {
      "type": "string",
      "enum": ["image", "text", "url", "file"],
      "description": "Attachment type. \"image\" = photos/screenshots (PNG, JPEG, WebP, etc.). \"text\" = plain text. \"url\" = hyperlink. \"file\" = documents (PDF, Office docs, etc.) for AI processing."
    },
    "mime": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9+\\.]*/.+$",
      "description": "MIME type (e.g., image/png, application/pdf, text/plain). Required for all kinds."
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255,
      "description": "Optional original filename or display name (e.g., 'screenshot.png', 'invoice.pdf'). Useful for context and logging."
    },
    "data": {
      "type": "string",
      "description": "Base64-encoded payload. For kind=image or kind=text, the decoded payload must not exceed 10 MB. For kind=file, the decoded payload must not exceed 10 MB in v1 (raisable later). Mutually exclusive with `url`; exactly one must be present."
    },
    "url": {
      "type": "string",
      "format": "uri",
      "pattern": "^https://",
      "description": "Absolute HTTPS URL pointing to the attachment. Used for kind=url (hyperlinks) or as a pre-uploaded blob URL instead of inline base64 data. Mutually exclusive with `data`; exactly one must be present."
    }
  },
  "allOf": [
    {
      "description": "Exactly one of data or url must be present",
      "oneOf": [
        { "required": ["data"], "not": { "required": ["url"] } },
        { "required": ["url"], "not": { "required": ["data"] } }
      ]
    }
  ]
}
