{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/usemektup-com/json-schema/usemektup-com-message-base-schema.json",
  "title": "MessageBase",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/usemektup-com-openapi.yaml#/components/schemas/MessageBase",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "direction": {
      "type": "string",
      "enum": [
        "inbound",
        "outbound"
      ]
    },
    "from_address": {
      "type": [
        "string",
        "null"
      ]
    },
    "to_address": {
      "type": [
        "string",
        "null"
      ]
    },
    "subject": {
      "type": [
        "string",
        "null"
      ]
    },
    "size_bytes": {
      "type": "integer"
    },
    "received_at": {
      "type": "string",
      "format": "date-time"
    },
    "read_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "deleted_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "flagged_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "folder_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "delivery_status": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "sent",
        "deferred",
        "bounced",
        null
      ],
      "description": "Only ever populated for direction=outbound. null means either too recent to have a result yet, or delivered locally to another Mektup mailbox rather than over external SMTP."
    },
    "delivery_detail": {
      "type": [
        "string",
        "null"
      ],
      "description": "The real SMTP response text from the recipient's mail server (Mektup has no relayhost, so its own MTA does the delivery attempt directly) - not a synthesized summary."
    },
    "delivery_checked_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    }
  }
}