{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/supermailos-com/json-schema/supermailos-com-thread-schema.json",
  "title": "Thread",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/supermailos-com-openapi.json#/components/schemas/Thread",
  "type": "object",
  "required": [
    "id",
    "mailboxId",
    "mailbox",
    "receivedOn",
    "subject",
    "snippet",
    "from",
    "participants",
    "folder",
    "unread",
    "starred",
    "labels",
    "lastMessageAt",
    "hasAttachments",
    "messageCount"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "mailboxId": {
      "type": "string"
    },
    "mailbox": {
      "type": "string",
      "format": "email",
      "description": "The mailbox's address."
    },
    "receivedOn": {
      "type": "string",
      "format": "email",
      "description": "Where the conversation arrived (an alias, if so) or the address it was sent from."
    },
    "subject": {
      "type": "string"
    },
    "snippet": {
      "type": "string"
    },
    "from": {
      "$ref": "#/$defs/EmailAddress",
      "description": "The other party: latest inbound sender, else the first recipient of the latest sent message."
    },
    "participants": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/EmailAddress"
      },
      "description": "From/To/Cc of every message — never Bcc."
    },
    "folder": {
      "type": "string",
      "enum": [
        "inbox",
        "sent",
        "drafts",
        "archive",
        "spam",
        "trash"
      ]
    },
    "unread": {
      "type": "boolean"
    },
    "starred": {
      "type": "boolean"
    },
    "labels": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "lastMessageAt": {
      "type": "string",
      "format": "date-time"
    },
    "snoozedUntil": {
      "type": "string",
      "format": "date-time"
    },
    "hasAttachments": {
      "type": "boolean"
    },
    "messageCount": {
      "type": "integer"
    }
  },
  "$defs": {
    "EmailAddress": {
      "type": "object",
      "required": [
        "email"
      ],
      "properties": {
        "email": {
          "type": "string",
          "format": "email"
        },
        "name": {
          "type": "string"
        }
      }
    }
  }
}