{
  "$id": "https://intentschema.org/intents/communication/email/draft/read/v1.json",
  "fqdn": "org.intentschema.communication.email.draft.read.v1",
  "title": "Read email draft",
  "description": "Read a single draft by id.",
  "payload": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "required": [
      "target"
    ],
    "properties": {
      "target": {
        "allOf": [
          {
            "$ref": "https://intentschema.org/common/target/v1.json"
          },
          {
            "required": [
              "external_id"
            ]
          }
        ]
      }
    }
  },
  "result": {
    "type": "object",
    "required": [
      "external_id"
    ],
    "properties": {
      "external_id": {
        "type": "string"
      },
      "object": {
        "type": "object",
        "properties": {
          "to": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "email",
              "description": "RFC 5321 mailbox. Plain address (jane@example.com) or with display name (\"Jane Doe\" <jane@example.com>)."
            }
          },
          "cc": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "email",
              "description": "RFC 5321 mailbox. Plain address (jane@example.com) or with display name (\"Jane Doe\" <jane@example.com>)."
            }
          },
          "bcc": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "email",
              "description": "RFC 5321 mailbox. Plain address (jane@example.com) or with display name (\"Jane Doe\" <jane@example.com>)."
            }
          },
          "subject": {
            "type": "string"
          },
          "textBody": {
            "type": "string"
          },
          "htmlBody": {
            "type": "string"
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "https://intentschema.org/common/blob-ref/v1.json"
            }
          },
          "inReplyTo": {
            "type": "string"
          }
        }
      },
      "updated_at": {
        "type": "string",
        "format": "date-time"
      }
    }
  },
  "examples": [
    {
      "name": "get draft",
      "value": {
        "target": {
          "system": "gmail",
          "external_id": "draft_abc"
        }
      }
    }
  ]
}
