{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.fideliyapass.com/schemas/webhooks/2026-11/milestone.reached.json",
  "type": "object",
  "properties": {
    "pass_id": {
      "type": "string",
      "minLength": 1
    },
    "customer_id": {
      "type": "string",
      "minLength": 1
    },
    "customer_pass_id": {
      "type": "string",
      "minLength": 1
    },
    "customer_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "milestone": {
      "type": "number",
      "description": "The card's total milestones after this one."
    },
    "reward_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "loyalty_type": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "visits",
            "points"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "loyalty_goal": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ]
    },
    "new_value": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ]
    },
    "timestamp": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
    },
    "customer_deleted": {
      "description": "Present, and true, once the business deleted this customer: their name and contact details are removed from this event (null), and a resend carries none. Show \"Deleted customer\".",
      "type": "boolean",
      "const": true
    },
    "customer_deleted_at": {
      "description": "When the business deleted this customer. Present with the flag above.",
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
    }
  },
  "required": [
    "pass_id",
    "customer_id",
    "customer_pass_id",
    "customer_name",
    "milestone",
    "reward_name",
    "loyalty_type",
    "loyalty_goal",
    "new_value",
    "timestamp"
  ],
  "description": "A customer reached a reward on their card.",
  "examples": [
    {
      "pass_id": "7f1d5c1e-2b7a-4c1e-9d0e-0c6f3c2a9b10",
      "customer_id": "c1f0e2d3-4b5a-4c6d-8e7f-9a0b1c2d3e4f",
      "customer_pass_id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
      "customer_name": "Ana Ruiz",
      "milestone": 1,
      "reward_name": "Free coffee",
      "loyalty_type": "visits",
      "loyalty_goal": 10,
      "new_value": 10,
      "timestamp": "2026-11-03T10:15:00.000Z"
    }
  ]
}
