{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title":"Statistic hit",
  "description":"Statistic hit",
  "type":"object",
  "properties":{
    "date":{
      "title":"Hit date",
      "type": "string",
      "format": "date-time"
    },
    "type":{
      "title":"Hit type",
      "type":"string",
      "enum": ["UPLOAD"]
    },
    "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",
      "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"
          }
        }
      }
    },
    "medias": {
      "title": "Medias",
      "type": "array",
      "minItems": 1,
      "items": {
        "title": "Media",
        "type": "object",
        "properties": {
          "mediaId": {
            "title": "Media ID",
            "type": "integer"
          }
        },
        "required": [
          "mediaId"
        ]
      },
      "minItems": 1
    },
    "upload":{
      "title":"Upload related information",
      "description": "Upload related information",
      "type": "object",
      "properties": {
        "contributionSpaceType":{
          "title":"Contribution space type",
          "type":"string",
          "enum": [
            "FOLDER",
            "WALL",
            "BASKET"
          ]
        },
        "contributionSpaceId":{
          "title":"Contribution space id (folder id or basket id)",
          "type":"integer"
        }
      },
      "required": [
        "contributionSpaceType"
      ]
    }
  },
  "required": [
    "date",
    "type",
    "ip",
    "medias",
    "upload"
  ],
  "additionalProperties": false
}
