{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.firstmilelabs.com/schemas/webhooks/case.exit.confirmed.v1.json",
  "title": "FirstMileLabs Outbound Webhook — case.exit.confirmed (v1)",
  "description": "A customer's exit was decided: a firm-led exit confirmed by an MLRO or above, or one the customer led recorded, in the app or through POST /v1/cases/{caseId}/exit. Nothing is sent before an exit is confirmed. 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",
    "confirmedAt"
  ],
  "properties": {
    "event": { "type": "string", "const": "case.exit.confirmed" },
    "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"], "description": "customer: they asked to leave, or stopped trading. firm: the firm ended it." },
    "endOn": { "type": "string", "format": "date", "description": "The day the relationship ends. The customer stays approved, and monitored, until then." },
    "state": { "type": "string", "const": "confirmed" },
    "confirmedAt": { "type": "string", "format": "date-time", "description": "When it was confirmed or recorded." }
  }
}
