{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/blinkinbox-club/json-schema/blinkinbox-club-message-schema.json",
  "title": "Message",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/blinkinbox-club-openapi.json#/components/schemas/Message",
  "allOf": [
    {
      "$ref": "#/$defs/MessageSummary"
    },
    {
      "type": "object",
      "properties": {
        "to": {
          "type": "string"
        },
        "text": {
          "type": "string"
        },
        "html": {
          "type": "string"
        },
        "codes": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "All code candidates, best first."
        },
        "links": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string"
              },
              "text": {
                "type": "string"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "verification",
                  "other"
                ]
              }
            }
          }
        },
        "attachments": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "filename": {
                "type": "string"
              },
              "contentType": {
                "type": "string"
              },
              "size": {
                "type": "integer"
              },
              "stored": {
                "type": "boolean",
                "description": "False when the file was not kept; see `skipped`."
              },
              "skipped": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "blocked_type",
                  "too_large",
                  "attachments_disabled",
                  null
                ],
                "description": "blocked_type: executables, scripts, installers, disk images, macro-enabled Office files, HTML and SVG are never stored. too_large: over the per-file or per-message size limit."
              },
              "archive": {
                "type": "boolean",
                "description": "True for zip, rar, 7z and similar. Archive contents are not scanned."
              }
            }
          }
        }
      }
    }
  ],
  "$defs": {
    "MessageSummary": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "from": {
          "type": "string"
        },
        "fromName": {
          "type": "string"
        },
        "subject": {
          "type": "string"
        },
        "preview": {
          "type": "string"
        },
        "receivedAt": {
          "type": "string",
          "format": "date-time"
        },
        "read": {
          "type": "boolean"
        },
        "otp": {
          "type": [
            "string",
            "null"
          ],
          "description": "Best-guess one-time code, extracted on arrival."
        },
        "verificationLink": {
          "type": [
            "string",
            "null"
          ],
          "description": "Best-guess verify / magic-link URL."
        },
        "attachments": {
          "type": "integer"
        }
      }
    }
  }
}