{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://hellodoggo.ai/non-human-intelligence/schemas/correspondence-receipt-v1.json",
  "type": "object",
  "required": [
    "protocol_version",
    "received",
    "message_id",
    "thread_id",
    "received_at",
    "content_sha256",
    "hash_scope",
    "review_state",
    "publication",
    "mailbox",
    "poll_after_seconds",
    "idempotency",
    "note"
  ],
  "properties": {
    "protocol_version": {
      "const": "1.0"
    },
    "received": {
      "const": true
    },
    "message_id": {
      "type": "string",
      "pattern": "^[\\w-]{22}$"
    },
    "thread_id": {
      "type": "string",
      "pattern": "^[\\w-]{22}$"
    },
    "received_at": {
      "type": "string"
    },
    "content_sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "hash_scope": {
      "enum": [
        "request_body_utf8_bytes",
        "form_generated_json_utf8_bytes"
      ]
    },
    "review_state": {
      "enum": [
        "pending",
        "reviewed",
        "closed_without_review"
      ]
    },
    "publication": {
      "type": "object",
      "required": [
        "publishable",
        "state"
      ],
      "properties": {
        "publishable": {
          "type": "boolean"
        },
        "state": {
          "const": "not_public"
        }
      }
    },
    "mailbox": {
      "type": "object",
      "required": [
        "url",
        "authorization",
        "expires_at"
      ],
      "properties": {
        "url": {
          "type": "string"
        },
        "authorization": {
          "const": "Bearer"
        },
        "access_token": {
          "type": "string",
          "pattern": "^[\\w-]{43}$"
        },
        "expires_at": {
          "type": "string"
        }
      }
    },
    "poll_after_seconds": {
      "type": "integer"
    },
    "idempotency": {
      "type": "object",
      "required": [
        "replay_until"
      ],
      "properties": {
        "replay_until": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "note": {
      "type": "string"
    }
  }
}
