{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/workwae-com/json-schema/workwae-com-message-schema.json",
  "title": "Message",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/workwae-com-v1-openapi.json#/components/schemas/Message",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "threadId": {
      "anyOf": [
        {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        },
        {
          "type": "null"
        }
      ]
    },
    "internetMessageId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "mailboxIds": {
      "type": "array",
      "items": {
        "type": "string",
        "format": "uuid"
      }
    },
    "subject": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "from": {
      "anyOf": [
        {
          "$ref": "#/$defs/Address"
        },
        {
          "type": "null"
        }
      ]
    },
    "to": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Address"
      }
    },
    "cc": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Address"
      }
    },
    "snippet": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "receivedAt": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "x-native-type": "date"
        },
        {
          "type": "null"
        }
      ]
    },
    "sentAt": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "x-native-type": "date"
        },
        {
          "type": "null"
        }
      ]
    },
    "isRead": {
      "type": "boolean"
    },
    "isFlagged": {
      "type": "boolean"
    },
    "isDraft": {
      "type": "boolean"
    },
    "hasAttachments": {
      "type": "boolean"
    },
    "categories": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "direction": {
      "$ref": "#/$defs/MessageDirection"
    },
    "outboxId": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ]
    },
    "reference": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "importance": {
      "anyOf": [
        {
          "$ref": "#/$defs/MessagePriority"
        },
        {
          "type": "null"
        }
      ]
    },
    "bcc": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Address"
      }
    },
    "replyTo": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Address"
      }
    },
    "body": {
      "$ref": "#/$defs/MessageBody"
    },
    "attachments": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Attachment"
      }
    },
    "classification": {
      "anyOf": [
        {
          "$ref": "#/$defs/MessageClassification"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "id",
    "threadId",
    "internetMessageId",
    "mailboxIds",
    "subject",
    "from",
    "to",
    "cc",
    "snippet",
    "receivedAt",
    "sentAt",
    "isRead",
    "isFlagged",
    "isDraft",
    "hasAttachments",
    "categories",
    "direction",
    "outboxId",
    "reference",
    "importance",
    "bcc",
    "replyTo",
    "body",
    "attachments",
    "classification"
  ],
  "$defs": {
    "Address": {
      "type": "object",
      "properties": {
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "address": {
          "type": "string"
        }
      },
      "required": [
        "name",
        "address"
      ]
    },
    "Attachment": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        },
        "filename": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "contentType": {
          "type": "string"
        },
        "size": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "isInline": {
          "type": "boolean"
        },
        "contentId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "filename",
        "contentType",
        "size",
        "isInline",
        "contentId"
      ]
    },
    "AutoReplyCategory": {
      "enum": [
        "out_of_office",
        "left_company",
        "address_changed",
        "ticket_acknowledgment",
        "challenge_response",
        "other"
      ],
      "type": "string"
    },
    "MessageBody": {
      "type": "object",
      "properties": {
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "html": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "text",
        "html"
      ]
    },
    "MessageClassification": {
      "type": "object",
      "properties": {
        "kind": {
          "$ref": "#/$defs/ReplyKind"
        },
        "probabilities": {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "type": "number"
          }
        },
        "optOutProbability": {
          "type": "number"
        },
        "autoReplyCategory": {
          "anyOf": [
            {
              "$ref": "#/$defs/AutoReplyCategory"
            },
            {
              "type": "null"
            }
          ]
        },
        "returnDate": {
          "anyOf": [
            {
              "type": "string",
              "format": "date"
            },
            {
              "type": "null"
            }
          ]
        },
        "alternateContacts": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "outboxId": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ]
        },
        "model": {
          "type": "string"
        },
        "classifiedAt": {
          "type": "string",
          "format": "date-time",
          "x-native-type": "date"
        }
      },
      "required": [
        "kind",
        "probabilities",
        "optOutProbability",
        "autoReplyCategory",
        "returnDate",
        "alternateContacts",
        "outboxId",
        "model",
        "classifiedAt"
      ]
    },
    "MessageDirection": {
      "enum": [
        "inbound",
        "outbound"
      ],
      "type": "string"
    },
    "MessagePriority": {
      "enum": [
        "high",
        "normal",
        "low"
      ],
      "type": "string"
    },
    "ReplyKind": {
      "enum": [
        "opt_out",
        "auto_reply",
        "bounce",
        "human_reply"
      ],
      "type": "string"
    }
  }
}