{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.firstmilelabs.com/schemas/webhooks/document.uploaded.v1.json",
  "title": "FirstMileLabs Outbound Webhook — document.uploaded (v1)",
  "description": "Emitted once per upload batch when one or more documents are uploaded to a case.",
  "type": "object",
  "additionalProperties": true,
  "required": [
    "event",
    "eventId",
    "eventVersion",
    "timestamp",
    "orgId",
    "caseId",
    "documentIds",
    "fileCount",
    "filenames"
  ],
  "properties": {
    "event": { "type": "string", "const": "document.uploaded" },
    "eventId": { "type": "string", "format": "uuid" },
    "eventVersion": { "type": "integer", "const": 1 },
    "timestamp": { "type": "string", "format": "date-time" },
    "orgId": { "type": "string" },
    "crmRecordId": { "type": ["string", "null"] },
    "caseId": { "type": "string" },
    "documentIds": {
      "type": "array",
      "items": { "type": "integer" },
      "description": "Internal IDs of every uploaded document."
    },
    "fileCount": { "type": "integer", "minimum": 1 },
    "filenames": {
      "type": "array",
      "items": { "type": "string" },
      "description": "Original filenames as supplied by the client."
    }
  }
}
