{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://developers.youareaccountable.com/schemas/plan_details.updated.json",
  "title": "PlanDetailsUpdated",
  "description": "A member's plan details are changed. Sends the full list, not just what changed.",
  "type": "object",
  "required": [
    "event_type",
    "data"
  ],
  "properties": {
    "event_type": {
      "const": "plan_details.updated"
    },
    "data": {
      "type": "object",
      "required": [
        "medical_record_number",
        "plan_details",
        "updated_at"
      ],
      "properties": {
        "medical_record_number": {
          "type": "string",
          "format": "uuid",
          "description": "The member's medical record number. Always a UUID. Use it to match the event to your own record."
        },
        "plan_name": {
          "type": [
            "string",
            "null"
          ],
          "description": "The member's Accountable plan. Can be null or left out."
        },
        "plan_details": {
          "type": "array",
          "description": "Every service on the member's plan. Empty when the plan has none. New values can be added.",
          "items": {
            "type": "string"
          }
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "description": "When this request was built. A retry has a new value."
        }
      }
    }
  },
  "examples": [
    {
      "event_type": "plan_details.updated",
      "data": {
        "medical_record_number": "3f2b8c1e-7a4d-4e9b-9c55-0d6a1f2e8b47",
        "plan_name": "Standard Plan",
        "plan_details": [
          "BAC Monitoring",
          "Coaching 1x Per Week",
          "Saliva Test 1x Per Week"
        ],
        "updated_at": "2026-01-01T15:00:00.000Z"
      }
    }
  ]
}
