TrackEvent:
  title: TrackEvent
  type: object
  properties:
    messageId:
      type: string
      format: uuid
      description: "Universally Unique Identifier (UUID) of the event, typically provided by the client SDKs."
      examples:
        - "9d107c24-79b6-11ee-b962-0242ac120002"
    userId:
      type: string
      description: "Unique identifier of the user who triggered the event, in the canonical format used by the identity provider of the source.\nIf not available, `anonymousId` is required.\nIf `userId` is set, the identity provider `context.idp` and the tenant `context.tn` must also be provided. The `userId` is anonymized during event processing."
      examples:
        - "202E194E-8113-42E5-8FD0-8425ABAFF53C"
    anonymousId:
      type: string
      format: uuid
      description: "A temporary, unique identifier for the user if the `userId` is not known.\nAt least one of `userId` and `anonymousId` is required."
      examples:
        - "00000000-0000-0000-0000-000000000000"
    channel:
      type: string
      enum: [ "server" ]
      description: "The origin of the event, e.g., `server` (sent server-side) or `mobile` (sent from mobile app).\nThis attribute helps to distinguish the source of the event."
    type:
      type: string
      enum: [ "track" ]
      description: "The type of event, e.g. `track` for event tracking or `identify` for user identification."
    event:
      type: string
      description: "The human-readable name of the event that was triggered. It serves as a unique and fixed identifier - see the detailed explanations and rules of RFC 71. The fully qualified event name is automatically set with information from the source configuration and has the format `dv_{groupKey}_{event}`."
      examples:
        - "DocumentUploaded"
    context:
      type: object
      description: "Additional context related to the event. This field contains metadata about the event. It describes the environment or context in which the event occurred."
      properties:
        schemaVersion:
          type: string
          description: "Semantic version of the schema. Applies exclusively to the structure of the `properties` object within the event payload."
          examples:
            - "1.0.0"
        idp:
          type: string
          enum: [ "dv_cloud_idp", "dv_portal_adfs", "dv_postbox_identityapp", "ms_entra" ]
          description: "The identity provider from which the user (`userId`) originates. Mandatory if this information is available to the client."
        tn:
          type: string
          description: "The id of the tenant. Mandatory if this information is available to the client. If the tenant id `tn` is set, the tenant provider `tp` must also be set."
          examples:
            - "3b1"
        tp:
          type: string
          enum: [ "dv_cloud", "dv_portal", "dv_postbox", "ms_entra" ]
          description: "The system or provider from which the tenant or tenant ID originates. Mandatory if this information is available to the client."
        app:
          type: object
          description: "Captures detailed information about the app."
          properties:
            name:
              type: string
              description: "The technical name of the app, identical to the name as it is used in the Well Architected App Review (https://git.d-velop.de/dvelop/architecture/well-architected-app-review/-/blob/main/README.md#getting-started)."
              examples:
                - "process"
            namespace:
              type: string
              enum: [ "dv" ]
              description: "Contains the namespace of the app, currently fixed to `dv`. Reserved for future extension with more namespaces."
            version:
              type: string
              description: "The version of the app (preferably follows SemVer v2)."
              examples:
                - "1.4.12"
            build:
              type: string
              description: "Contains information on the specific build of the app."
              examples:
                - "cloud-prod-44548e20"
          required:
            - name
            - namespace
            - version
        library:
          type: object
          description: "Information automatically set by client SDKs about the name and version of the SDK.\nIf no off-the-shelf client SDK is used, values should be provided here that clearly identify the custom implementation."
          properties:
            name:
              type: string
              description: "The name of the client SDK."
              examples:
                - "RudderAnalytics.NET"
            version:
              type: string
              description: "The version of the client SDK used (preferably follows SemVer v2)."
              examples:
                - "2.0.0"
        userAgent:
          type: string
          description: "The user agent of the client that sent the event."
        env:
          type: string
          enum: [ "dev", "qa", "prod" ]
          description: "Specifies the logical deployment environment from which the event originates."
        hm:
          type: string
          enum: [ "cloud" ]
          description: "Specifies the hosting model from which the event originates."
        dm:
          type: string
          enum: [ "multiTenant" ]
          description: "The deployment model in which the event was emitted.\nIf the hosting model is set to `cloud`, the deployment model must also be specified."
        cp:
          type: string
          enum: [ "aws", "otc", "stackit", "aws-eu-sc" ]
          description: "Specifies the cloud provider from which the event originated.\nIf the hosting model is set to `cloud`, the cloud provider must also be specified."
        dcr:
          type: string
          description: "Specifies the data center region from which the event originated.\nIf the hosting model is set to `cloud`, the data center region must also be specified."
          examples:
            - "eu-central-1"
        al:
          type: string
          enum: [ "native", "ddp" ]
          description: "The abstraction layer on which the app is based."
      required:
        - schemaVersion
        - app
        - env
        - hm
        - al
    timestamp:
      type: string
      format: date-time
      description: "The time at which the event occurred. When not set, the value is calculated to account for any client-side clock skew. It is calculated using the formula: timestamp = receivedAt - (sentAt - originalTimestamp)."
    originalTimestamp:
      type: string
      format: date-time
      description: "Records the actual time when the event occurred."
    sentAt:
      type: string
      format: date-time
      description: "Captures the time when the event was sent from the client to the server."
  required:
    - channel
    - type
    - event
    - context
  additionalProperties: false