{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.firstmilelabs.com/schemas/webhooks/case.exit.ended.v1.json",
  "title": "FirstMileLabs Outbound Webhook — case.exit.ended (v1)",
  "description": "A customer's exit ended on its end date: the case is exited. case.status.changed is sent with it, status \"exited\", in no set order. Identifiers, who led it, its state and its dates only: never why the relationship ended, a note, or anyone's name.",
  "type": "object",
  "additionalProperties": true,
  "required": [
    "event",
    "eventId",
    "eventVersion",
    "timestamp",
    "orgId",
    "caseId",
    "exitId",
    "ledBy",
    "endOn",
    "state",
    "endedAt"
  ],
  "properties": {
    "event": { "type": "string", "const": "case.exit.ended" },
    "eventId": { "type": "string", "format": "uuid" },
    "eventVersion": { "type": "integer", "const": 1 },
    "timestamp": { "type": "string", "format": "date-time" },
    "orgId": { "type": "string" },
    "crmRecordId": { "type": ["string", "null"], "description": "Your own reference for the case, when it has one." },
    "crmSource": { "type": ["string", "null"] },
    "caseId": { "type": "string", "description": "The customer's case." },
    "exitId": { "type": "string", "format": "uuid", "description": "The exit. Stable across every event for the same exit." },
    "ledBy": { "type": "string", "enum": ["customer", "firm"] },
    "endOn": { "type": "string", "format": "date", "description": "The day the relationship ended. The record-keeping clock runs from it." },
    "state": { "type": "string", "const": "ended" },
    "endedAt": { "type": "string", "format": "date-time", "description": "When it ended: later than endOn when something open on the case held the end back." }
  }
}
