{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/samva-dev/json-schema/samva-dev-create-event-payload-schema.json",
  "title": "CreateEventPayload",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/samva-dev-events-api-openapi.yml#/components/schemas/CreateEventPayload",
  "type": "object",
  "properties": {
    "contact": {
      "$ref": "#/$defs/ContactEventReference"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255,
      "x-samva-string-checks": [
        {
          "id": "effect/schema/isMaxLength",
          "payload": {
            "maxLength": 255
          }
        },
        {
          "id": "effect/schema/isPattern",
          "payload": {
            "source": "^(?!(?:[Cc][Oo][Nn][Tt][Aa][Cc][Tt]|[Ss][Aa][Mm][Vv][Aa])\\.)[A-Za-z][A-Za-z0-9_.-]*$",
            "flags": ""
          }
        }
      ]
    },
    "properties": {
      "anyOf": [
        {
          "$ref": "#/$defs/JsonObject"
        },
        {
          "type": "null"
        }
      ]
    },
    "occurredAt": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "contact",
    "name"
  ],
  "additionalProperties": false,
  "$defs": {
    "ContactEventReference": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "id": {
              "$ref": "#/$defs/ContactId"
            },
            "externalId": {
              "not": {}
            },
            "email": {
              "not": {}
            }
          },
          "required": [
            "id"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "externalId": {
              "type": "string",
              "minLength": 1
            },
            "id": {
              "not": {}
            },
            "email": {
              "not": {}
            }
          },
          "required": [
            "externalId"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "email": {
              "type": "string",
              "pattern": "^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$"
            },
            "id": {
              "not": {}
            },
            "externalId": {
              "not": {}
            }
          },
          "required": [
            "email"
          ],
          "additionalProperties": false
        }
      ]
    },
    "ContactId": {
      "type": "string",
      "pattern": "^contact_[0-9a-hjkmnp-tv-z]{16,24}$",
      "x-samva-brand": "ContactId"
    },
    "JsonObject": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/JsonValue"
      }
    },
    "JsonValue": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        },
        {
          "type": "null"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/JsonValue"
          }
        },
        {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/JsonValue"
          }
        }
      ]
    }
  }
}