{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "oneOf": [
    {
      "additionalProperties": false,
      "properties": {
        "actor": {
          "additionalProperties": false,
          "properties": {
            "id": {
              "minLength": 1,
              "type": "string"
            },
            "type": {
              "enum": ["end_user", "workspace_member", "api_key", "system"],
              "type": "string"
            }
          },
          "required": ["type"],
          "type": "object"
        },
        "environmentId": {
          "minLength": 1,
          "type": "string"
        },
        "eventId": {
          "pattern": "^evt_[a-z2-7]{32}$",
          "type": "string"
        },
        "occurredAt": {
          "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))$",
          "type": "string"
        },
        "payload": {
          "additionalProperties": false,
          "properties": {
            "maskedEmail": {
              "pattern": "^[^\\s@]*\\*+[^\\s@]*@[^\\s@]*\\*+[^\\s@]*$",
              "type": "string"
            },
            "method": {
              "enum": ["email_otp", "passkey", "social"],
              "type": "string"
            },
            "userId": {
              "pattern": "^usr_[a-z2-7]{32}$",
              "type": "string"
            }
          },
          "required": ["userId", "method"],
          "type": "object"
        },
        "trace": {
          "additionalProperties": false,
          "properties": {
            "correlationId": {
              "minLength": 1,
              "type": "string"
            },
            "requestId": {
              "minLength": 1,
              "type": "string"
            }
          },
          "type": "object"
        },
        "type": {
          "const": "user.created",
          "type": "string"
        },
        "version": {
          "const": 1,
          "type": "number"
        },
        "workspaceId": {
          "minLength": 1,
          "type": "string"
        }
      },
      "required": ["eventId", "type", "version", "occurredAt", "workspaceId", "payload", "trace"],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "actor": {
          "additionalProperties": false,
          "properties": {
            "id": {
              "minLength": 1,
              "type": "string"
            },
            "type": {
              "enum": ["end_user", "workspace_member", "api_key", "system"],
              "type": "string"
            }
          },
          "required": ["type"],
          "type": "object"
        },
        "environmentId": {
          "minLength": 1,
          "type": "string"
        },
        "eventId": {
          "pattern": "^evt_[a-z2-7]{32}$",
          "type": "string"
        },
        "occurredAt": {
          "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))$",
          "type": "string"
        },
        "payload": {
          "additionalProperties": false,
          "properties": {
            "changedFields": {
              "items": {
                "minLength": 1,
                "type": "string"
              },
              "minItems": 1,
              "type": "array"
            },
            "userId": {
              "pattern": "^usr_[a-z2-7]{32}$",
              "type": "string"
            }
          },
          "required": ["userId", "changedFields"],
          "type": "object"
        },
        "trace": {
          "additionalProperties": false,
          "properties": {
            "correlationId": {
              "minLength": 1,
              "type": "string"
            },
            "requestId": {
              "minLength": 1,
              "type": "string"
            }
          },
          "type": "object"
        },
        "type": {
          "const": "user.updated",
          "type": "string"
        },
        "version": {
          "const": 1,
          "type": "number"
        },
        "workspaceId": {
          "minLength": 1,
          "type": "string"
        }
      },
      "required": ["eventId", "type", "version", "occurredAt", "workspaceId", "payload", "trace"],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "actor": {
          "additionalProperties": false,
          "properties": {
            "id": {
              "minLength": 1,
              "type": "string"
            },
            "type": {
              "enum": ["end_user", "workspace_member", "api_key", "system"],
              "type": "string"
            }
          },
          "required": ["type"],
          "type": "object"
        },
        "environmentId": {
          "minLength": 1,
          "type": "string"
        },
        "eventId": {
          "pattern": "^evt_[a-z2-7]{32}$",
          "type": "string"
        },
        "occurredAt": {
          "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))$",
          "type": "string"
        },
        "payload": {
          "additionalProperties": false,
          "properties": {
            "reason": {
              "enum": ["user_request", "admin_action"],
              "type": "string"
            },
            "userId": {
              "pattern": "^usr_[a-z2-7]{32}$",
              "type": "string"
            }
          },
          "required": ["userId"],
          "type": "object"
        },
        "trace": {
          "additionalProperties": false,
          "properties": {
            "correlationId": {
              "minLength": 1,
              "type": "string"
            },
            "requestId": {
              "minLength": 1,
              "type": "string"
            }
          },
          "type": "object"
        },
        "type": {
          "const": "user.deleted",
          "type": "string"
        },
        "version": {
          "const": 1,
          "type": "number"
        },
        "workspaceId": {
          "minLength": 1,
          "type": "string"
        }
      },
      "required": ["eventId", "type", "version", "occurredAt", "workspaceId", "payload", "trace"],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "actor": {
          "additionalProperties": false,
          "properties": {
            "id": {
              "minLength": 1,
              "type": "string"
            },
            "type": {
              "enum": ["end_user", "workspace_member", "api_key", "system"],
              "type": "string"
            }
          },
          "required": ["type"],
          "type": "object"
        },
        "environmentId": {
          "minLength": 1,
          "type": "string"
        },
        "eventId": {
          "pattern": "^evt_[a-z2-7]{32}$",
          "type": "string"
        },
        "occurredAt": {
          "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))$",
          "type": "string"
        },
        "payload": {
          "additionalProperties": false,
          "properties": {
            "reason": {
              "enum": ["admin_action", "abuse_detection"],
              "type": "string"
            },
            "userId": {
              "pattern": "^usr_[a-z2-7]{32}$",
              "type": "string"
            }
          },
          "required": ["userId"],
          "type": "object"
        },
        "trace": {
          "additionalProperties": false,
          "properties": {
            "correlationId": {
              "minLength": 1,
              "type": "string"
            },
            "requestId": {
              "minLength": 1,
              "type": "string"
            }
          },
          "type": "object"
        },
        "type": {
          "const": "user.blocked",
          "type": "string"
        },
        "version": {
          "const": 1,
          "type": "number"
        },
        "workspaceId": {
          "minLength": 1,
          "type": "string"
        }
      },
      "required": ["eventId", "type", "version", "occurredAt", "workspaceId", "payload", "trace"],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "actor": {
          "additionalProperties": false,
          "properties": {
            "id": {
              "minLength": 1,
              "type": "string"
            },
            "type": {
              "enum": ["end_user", "workspace_member", "api_key", "system"],
              "type": "string"
            }
          },
          "required": ["type"],
          "type": "object"
        },
        "environmentId": {
          "minLength": 1,
          "type": "string"
        },
        "eventId": {
          "pattern": "^evt_[a-z2-7]{32}$",
          "type": "string"
        },
        "occurredAt": {
          "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))$",
          "type": "string"
        },
        "payload": {
          "additionalProperties": false,
          "properties": {
            "identityId": {
              "pattern": "^idn_[a-z2-7]{32}$",
              "type": "string"
            },
            "provider": {
              "maxLength": 64,
              "minLength": 1,
              "type": "string"
            },
            "userId": {
              "pattern": "^usr_[a-z2-7]{32}$",
              "type": "string"
            }
          },
          "required": ["userId", "identityId", "provider"],
          "type": "object"
        },
        "trace": {
          "additionalProperties": false,
          "properties": {
            "correlationId": {
              "minLength": 1,
              "type": "string"
            },
            "requestId": {
              "minLength": 1,
              "type": "string"
            }
          },
          "type": "object"
        },
        "type": {
          "const": "identity.linked",
          "type": "string"
        },
        "version": {
          "const": 1,
          "type": "number"
        },
        "workspaceId": {
          "minLength": 1,
          "type": "string"
        }
      },
      "required": ["eventId", "type", "version", "occurredAt", "workspaceId", "payload", "trace"],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "actor": {
          "additionalProperties": false,
          "properties": {
            "id": {
              "minLength": 1,
              "type": "string"
            },
            "type": {
              "enum": ["end_user", "workspace_member", "api_key", "system"],
              "type": "string"
            }
          },
          "required": ["type"],
          "type": "object"
        },
        "environmentId": {
          "minLength": 1,
          "type": "string"
        },
        "eventId": {
          "pattern": "^evt_[a-z2-7]{32}$",
          "type": "string"
        },
        "occurredAt": {
          "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))$",
          "type": "string"
        },
        "payload": {
          "additionalProperties": false,
          "properties": {
            "identityId": {
              "pattern": "^idn_[a-z2-7]{32}$",
              "type": "string"
            },
            "provider": {
              "maxLength": 64,
              "minLength": 1,
              "type": "string"
            },
            "userId": {
              "pattern": "^usr_[a-z2-7]{32}$",
              "type": "string"
            }
          },
          "required": ["userId", "identityId", "provider"],
          "type": "object"
        },
        "trace": {
          "additionalProperties": false,
          "properties": {
            "correlationId": {
              "minLength": 1,
              "type": "string"
            },
            "requestId": {
              "minLength": 1,
              "type": "string"
            }
          },
          "type": "object"
        },
        "type": {
          "const": "identity.unlinked",
          "type": "string"
        },
        "version": {
          "const": 1,
          "type": "number"
        },
        "workspaceId": {
          "minLength": 1,
          "type": "string"
        }
      },
      "required": ["eventId", "type", "version", "occurredAt", "workspaceId", "payload", "trace"],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "actor": {
          "additionalProperties": false,
          "properties": {
            "id": {
              "minLength": 1,
              "type": "string"
            },
            "type": {
              "enum": ["end_user", "workspace_member", "api_key", "system"],
              "type": "string"
            }
          },
          "required": ["type"],
          "type": "object"
        },
        "environmentId": {
          "minLength": 1,
          "type": "string"
        },
        "eventId": {
          "pattern": "^evt_[a-z2-7]{32}$",
          "type": "string"
        },
        "occurredAt": {
          "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))$",
          "type": "string"
        },
        "payload": {
          "additionalProperties": false,
          "properties": {
            "aaguid": {
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
              "type": "string"
            },
            "backedUp": {
              "type": "boolean"
            },
            "passkeyId": {
              "pattern": "^psk_[a-z2-7]{32}$",
              "type": "string"
            },
            "userId": {
              "pattern": "^usr_[a-z2-7]{32}$",
              "type": "string"
            }
          },
          "required": ["userId", "passkeyId"],
          "type": "object"
        },
        "trace": {
          "additionalProperties": false,
          "properties": {
            "correlationId": {
              "minLength": 1,
              "type": "string"
            },
            "requestId": {
              "minLength": 1,
              "type": "string"
            }
          },
          "type": "object"
        },
        "type": {
          "const": "passkey.created",
          "type": "string"
        },
        "version": {
          "const": 1,
          "type": "number"
        },
        "workspaceId": {
          "minLength": 1,
          "type": "string"
        }
      },
      "required": ["eventId", "type", "version", "occurredAt", "workspaceId", "payload", "trace"],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "actor": {
          "additionalProperties": false,
          "properties": {
            "id": {
              "minLength": 1,
              "type": "string"
            },
            "type": {
              "enum": ["end_user", "workspace_member", "api_key", "system"],
              "type": "string"
            }
          },
          "required": ["type"],
          "type": "object"
        },
        "environmentId": {
          "minLength": 1,
          "type": "string"
        },
        "eventId": {
          "pattern": "^evt_[a-z2-7]{32}$",
          "type": "string"
        },
        "occurredAt": {
          "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))$",
          "type": "string"
        },
        "payload": {
          "additionalProperties": false,
          "properties": {
            "passkeyId": {
              "pattern": "^psk_[a-z2-7]{32}$",
              "type": "string"
            },
            "userId": {
              "pattern": "^usr_[a-z2-7]{32}$",
              "type": "string"
            }
          },
          "required": ["userId", "passkeyId"],
          "type": "object"
        },
        "trace": {
          "additionalProperties": false,
          "properties": {
            "correlationId": {
              "minLength": 1,
              "type": "string"
            },
            "requestId": {
              "minLength": 1,
              "type": "string"
            }
          },
          "type": "object"
        },
        "type": {
          "const": "passkey.deleted",
          "type": "string"
        },
        "version": {
          "const": 1,
          "type": "number"
        },
        "workspaceId": {
          "minLength": 1,
          "type": "string"
        }
      },
      "required": ["eventId", "type", "version", "occurredAt", "workspaceId", "payload", "trace"],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "actor": {
          "additionalProperties": false,
          "properties": {
            "id": {
              "minLength": 1,
              "type": "string"
            },
            "type": {
              "enum": ["end_user", "workspace_member", "api_key", "system"],
              "type": "string"
            }
          },
          "required": ["type"],
          "type": "object"
        },
        "environmentId": {
          "minLength": 1,
          "type": "string"
        },
        "eventId": {
          "pattern": "^evt_[a-z2-7]{32}$",
          "type": "string"
        },
        "occurredAt": {
          "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))$",
          "type": "string"
        },
        "payload": {
          "additionalProperties": false,
          "properties": {
            "clientId": {
              "pattern": "^cli_[a-z2-7]{32}$",
              "type": "string"
            },
            "ipPrefixHash": {
              "pattern": "^[0-9a-f]{64}$",
              "type": "string"
            },
            "method": {
              "enum": ["email_otp", "passkey", "social", "refresh_token"],
              "type": "string"
            },
            "sessionId": {
              "pattern": "^ses_[a-z2-7]{32}$",
              "type": "string"
            },
            "userId": {
              "pattern": "^usr_[a-z2-7]{32}$",
              "type": "string"
            }
          },
          "required": ["userId", "sessionId", "method"],
          "type": "object"
        },
        "trace": {
          "additionalProperties": false,
          "properties": {
            "correlationId": {
              "minLength": 1,
              "type": "string"
            },
            "requestId": {
              "minLength": 1,
              "type": "string"
            }
          },
          "type": "object"
        },
        "type": {
          "const": "session.created",
          "type": "string"
        },
        "version": {
          "const": 1,
          "type": "number"
        },
        "workspaceId": {
          "minLength": 1,
          "type": "string"
        }
      },
      "required": ["eventId", "type", "version", "occurredAt", "workspaceId", "payload", "trace"],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "actor": {
          "additionalProperties": false,
          "properties": {
            "id": {
              "minLength": 1,
              "type": "string"
            },
            "type": {
              "enum": ["end_user", "workspace_member", "api_key", "system"],
              "type": "string"
            }
          },
          "required": ["type"],
          "type": "object"
        },
        "environmentId": {
          "minLength": 1,
          "type": "string"
        },
        "eventId": {
          "pattern": "^evt_[a-z2-7]{32}$",
          "type": "string"
        },
        "occurredAt": {
          "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))$",
          "type": "string"
        },
        "payload": {
          "additionalProperties": false,
          "properties": {
            "reason": {
              "enum": ["user_logout", "admin_revocation", "refresh_token_reuse", "session_expired"],
              "type": "string"
            },
            "sessionId": {
              "pattern": "^ses_[a-z2-7]{32}$",
              "type": "string"
            },
            "userId": {
              "pattern": "^usr_[a-z2-7]{32}$",
              "type": "string"
            }
          },
          "required": ["userId", "sessionId", "reason"],
          "type": "object"
        },
        "trace": {
          "additionalProperties": false,
          "properties": {
            "correlationId": {
              "minLength": 1,
              "type": "string"
            },
            "requestId": {
              "minLength": 1,
              "type": "string"
            }
          },
          "type": "object"
        },
        "type": {
          "const": "session.revoked",
          "type": "string"
        },
        "version": {
          "const": 1,
          "type": "number"
        },
        "workspaceId": {
          "minLength": 1,
          "type": "string"
        }
      },
      "required": ["eventId", "type", "version", "occurredAt", "workspaceId", "payload", "trace"],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "actor": {
          "additionalProperties": false,
          "properties": {
            "id": {
              "minLength": 1,
              "type": "string"
            },
            "type": {
              "enum": ["end_user", "workspace_member", "api_key", "system"],
              "type": "string"
            }
          },
          "required": ["type"],
          "type": "object"
        },
        "environmentId": {
          "minLength": 1,
          "type": "string"
        },
        "eventId": {
          "pattern": "^evt_[a-z2-7]{32}$",
          "type": "string"
        },
        "occurredAt": {
          "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))$",
          "type": "string"
        },
        "payload": {
          "additionalProperties": false,
          "properties": {
            "clientId": {
              "pattern": "^cli_[a-z2-7]{32}$",
              "type": "string"
            },
            "ipPrefixHash": {
              "pattern": "^[0-9a-f]{64}$",
              "type": "string"
            },
            "method": {
              "enum": ["email_otp", "passkey", "social", "refresh_token"],
              "type": "string"
            },
            "sessionId": {
              "pattern": "^ses_[a-z2-7]{32}$",
              "type": "string"
            },
            "userId": {
              "pattern": "^usr_[a-z2-7]{32}$",
              "type": "string"
            }
          },
          "required": ["userId", "sessionId", "method"],
          "type": "object"
        },
        "trace": {
          "additionalProperties": false,
          "properties": {
            "correlationId": {
              "minLength": 1,
              "type": "string"
            },
            "requestId": {
              "minLength": 1,
              "type": "string"
            }
          },
          "type": "object"
        },
        "type": {
          "const": "login.succeeded",
          "type": "string"
        },
        "version": {
          "const": 1,
          "type": "number"
        },
        "workspaceId": {
          "minLength": 1,
          "type": "string"
        }
      },
      "required": ["eventId", "type", "version", "occurredAt", "workspaceId", "payload", "trace"],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "actor": {
          "additionalProperties": false,
          "properties": {
            "id": {
              "minLength": 1,
              "type": "string"
            },
            "type": {
              "enum": ["end_user", "workspace_member", "api_key", "system"],
              "type": "string"
            }
          },
          "required": ["type"],
          "type": "object"
        },
        "environmentId": {
          "minLength": 1,
          "type": "string"
        },
        "eventId": {
          "pattern": "^evt_[a-z2-7]{32}$",
          "type": "string"
        },
        "occurredAt": {
          "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))$",
          "type": "string"
        },
        "payload": {
          "additionalProperties": false,
          "properties": {
            "clientId": {
              "pattern": "^cli_[a-z2-7]{32}$",
              "type": "string"
            },
            "ipPrefixHash": {
              "pattern": "^[0-9a-f]{64}$",
              "type": "string"
            },
            "maskedEmail": {
              "pattern": "^[^\\s@]*\\*+[^\\s@]*@[^\\s@]*\\*+[^\\s@]*$",
              "type": "string"
            },
            "method": {
              "enum": ["email_otp", "passkey", "social", "refresh_token"],
              "type": "string"
            },
            "reason": {
              "enum": [
                "invalid_code",
                "expired_code",
                "passkey_verification_failed",
                "social_provider_error",
                "user_blocked",
                "email_suppressed"
              ],
              "type": "string"
            },
            "userId": {
              "pattern": "^usr_[a-z2-7]{32}$",
              "type": "string"
            }
          },
          "required": ["method", "reason"],
          "type": "object"
        },
        "trace": {
          "additionalProperties": false,
          "properties": {
            "correlationId": {
              "minLength": 1,
              "type": "string"
            },
            "requestId": {
              "minLength": 1,
              "type": "string"
            }
          },
          "type": "object"
        },
        "type": {
          "const": "login.failed",
          "type": "string"
        },
        "version": {
          "const": 1,
          "type": "number"
        },
        "workspaceId": {
          "minLength": 1,
          "type": "string"
        }
      },
      "required": ["eventId", "type", "version", "occurredAt", "workspaceId", "payload", "trace"],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "actor": {
          "additionalProperties": false,
          "properties": {
            "id": {
              "minLength": 1,
              "type": "string"
            },
            "type": {
              "enum": ["end_user", "workspace_member", "api_key", "system"],
              "type": "string"
            }
          },
          "required": ["type"],
          "type": "object"
        },
        "environmentId": {
          "minLength": 1,
          "type": "string"
        },
        "eventId": {
          "pattern": "^evt_[a-z2-7]{32}$",
          "type": "string"
        },
        "occurredAt": {
          "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))$",
          "type": "string"
        },
        "payload": {
          "additionalProperties": false,
          "properties": {
            "bounceType": {
              "enum": ["hard", "soft"],
              "type": "string"
            },
            "deliveryId": {
              "pattern": "^dlv_[a-z2-7]{32}$",
              "type": "string"
            },
            "messageId": {
              "minLength": 1,
              "type": "string"
            },
            "recipientHash": {
              "pattern": "^[A-Za-z0-9_-]{43}$",
              "type": "string"
            }
          },
          "required": ["deliveryId", "recipientHash", "bounceType"],
          "type": "object"
        },
        "trace": {
          "additionalProperties": false,
          "properties": {
            "correlationId": {
              "minLength": 1,
              "type": "string"
            },
            "requestId": {
              "minLength": 1,
              "type": "string"
            }
          },
          "type": "object"
        },
        "type": {
          "const": "email.delivery.bounced",
          "type": "string"
        },
        "version": {
          "const": 1,
          "type": "number"
        },
        "workspaceId": {
          "minLength": 1,
          "type": "string"
        }
      },
      "required": ["eventId", "type", "version", "occurredAt", "workspaceId", "payload", "trace"],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "actor": {
          "additionalProperties": false,
          "properties": {
            "id": {
              "minLength": 1,
              "type": "string"
            },
            "type": {
              "enum": ["end_user", "workspace_member", "api_key", "system"],
              "type": "string"
            }
          },
          "required": ["type"],
          "type": "object"
        },
        "environmentId": {
          "minLength": 1,
          "type": "string"
        },
        "eventId": {
          "pattern": "^evt_[a-z2-7]{32}$",
          "type": "string"
        },
        "occurredAt": {
          "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))$",
          "type": "string"
        },
        "payload": {
          "additionalProperties": false,
          "properties": {
            "billingMonth": {
              "pattern": "^\\d{4}-(0[1-9]|1[0-2])$",
              "type": "string"
            },
            "currentMau": {
              "maximum": 9007199254740991,
              "minimum": 0,
              "type": "integer"
            },
            "freeTierLimit": {
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991,
              "type": "integer"
            },
            "thresholdPercent": {
              "anyOf": [
                {
                  "const": 80,
                  "type": "number"
                },
                {
                  "const": 95,
                  "type": "number"
                },
                {
                  "const": 100,
                  "type": "number"
                }
              ]
            }
          },
          "required": ["billingMonth", "thresholdPercent", "currentMau", "freeTierLimit"],
          "type": "object"
        },
        "trace": {
          "additionalProperties": false,
          "properties": {
            "correlationId": {
              "minLength": 1,
              "type": "string"
            },
            "requestId": {
              "minLength": 1,
              "type": "string"
            }
          },
          "type": "object"
        },
        "type": {
          "const": "mau.threshold_reached",
          "type": "string"
        },
        "version": {
          "const": 1,
          "type": "number"
        },
        "workspaceId": {
          "minLength": 1,
          "type": "string"
        }
      },
      "required": ["eventId", "type", "version", "occurredAt", "workspaceId", "payload", "trace"],
      "type": "object"
    }
  ]
}
