{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://modele-donnees-filiere-enquete.insee.fr/specs/2.3.0/Event.json",
  "title": "Event",
  "type": "object",
  "description": "multimode Event",
  "properties": {
    "correlationId": {
      "type": "string",
      "format": "uuid",
      "description": "Unique identifier for the Event"
    },
    "eventType": {
      "type": "string",
      "enum": [
        "MULTIMODE_MOVED",
        "QUESTIONNAIRE_INIT",
        "QUESTIONNAIRE_LEAF_STATES_UPDATED",
        "QUESTIONNAIRE_UPDATED",
        "QUESTIONNAIRE_COMPLETED",
        "QUESTIONNAIRE_VALIDATED",
        "QUESTIONNAIRE_SWITCH_CAPI"
      ]
    },
    "aggregateType": {
      "type": "string",
      "enum": [
        "QUESTIONNAIRE"
      ]
    },
    "payload": {
      "type": "object",
      "description": "Content specific to the event type",
      "properties": {
        "interrogationId": {
          "type": "string",
          "description": "Identifier of the survey unit or interrogation"
        },
        "mode": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "title": "Mode",
          "description": "Collect modes",
          "type": "string",
          "enum": [
            "CATI",
            "CAPI",
            "CAWI",
            "PAPI"
          ]
        },
        "leafStates": {
          "type": "array",
          "description": "Leaf states (if applicable)",
          "items": {
            "type": "object",
            "properties": {
              "state": {
                "type": "string",
                "enum": [
                  "INIT",
                  "COMPLETED"
                ],
                "nullable": true
              },
              "date": {
                "type": "string",
                "format": "date-time",
                "x-field-extra-annotation": "@com.fasterxml.jackson.annotation.JsonFormat(shape = com.fasterxml.jackson.annotation.JsonFormat.Shape.STRING, timezone = \"UTC\")"
              }
            },
            "required": [
              "date"
            ]
          }
        }
      },
      "required": [
        "interrogationId",
        "mode"
      ]
    }
  },
  "required": [
    "eventType",
    "aggregateType",
    "payload"
  ]
}