{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title":"Statistic connection hit",
  "description":"Statistic connection hit",
  "type":"object",
  "properties":{
    "date":{
      "title":"Hit date",
      "type": "string",
      "format": "date-time"
    },
    "type":{
      "title":"Hit type",
      "type":"string",
      "enum": ["CONNECTION"]
    },
    "origin":{
      "title":"Hit origin",
      "type": "integer"
    },
    "sessionId":{
      "title":"Unique id to track a session",
      "type":"string"
    },
    "ip":{
      "title":"Sender ip",
      "type":"string",
      "oneOf": [
        {
          "format": "ipv4"
        },
        {
          "format": "ipv6"
        }
      ]
    },
    "referrer":{
      "title":"Referrer",
      "type":"string"
    },
    "users": {
      "title": "Users",
      "type": "array",
      "minItems": 1,
      "items": {
        "title": "User",
        "type": "object",
        "properties": {
          "userId": {
            "title": "User ID",
            "type": "integer"
          },
          "firstName": {
            "title": "User first name",
            "type": "string"
          },
          "lastName": {
            "title": "User last name",
            "type": "string"
          },
          "email": {
            "title": "User e-mail",
            "type": "string"
          }
        }
      }
    },
    "connection":{
      "title":"Connection related information",
      "description": "Connection related information",
      "type": "object",
      "properties": {
        "mode":{
          "title":"Connection mode",
          "type":"string",
          "enum": [
            "CLASSIC",
            "SSO",
            "ANONYMOUS"
          ]
        },
        "success":{
          "title":"Connection success",
          "type": "boolean"
        }
      },
      "required": [
        "mode",
        "success"
      ]
    }
  },
  "required": [
    "date",
    "type",
    "ip",
    "users",
    "connection"
  ],
  "additionalProperties": false
}
