{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "organizationId": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "replies": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "thread": {
            "type": "object",
            "properties": {
              "account_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              "thread_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              "provider": {
                "type": "string",
                "enum": ["gmail", "outlook", "instantly"]
              }
            },
            "required": ["account_id", "thread_id", "provider"],
            "additionalProperties": false
          },
          "mailbox": {
            "type": ["string", "null"]
          },
          "subject": {
            "type": "string"
          },
          "to": {
            "type": "string"
          },
          "revision": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "status": {
            "type": "string",
            "enum": ["scheduled", "sending", "uncertain", "failed"]
          },
          "sendAt": {
            "type": "string"
          },
          "failedAt": {
            "type": ["string", "null"]
          },
          "snippet": {
            "type": "string"
          },
          "reviewUrl": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "thread",
          "mailbox",
          "subject",
          "to",
          "revision",
          "status",
          "sendAt",
          "failedAt",
          "reviewUrl"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": ["organizationId", "replies"],
  "additionalProperties": false
}
