{
    "type": "object",
    "required": [
        "alias",
        "source",
        "thread_id",
        "packet_id",
        "daemon_event_id",
        "daemon_event_name",
        "global_ts_usec",
        "version",
        "ndpi_version",
        "ndpi_api_version",
        "size_per_flow"
    ],
    "if": {
        "properties": { "daemon_event_name": { "enum": [ "init", "reconnect" ] } }
    },
    "then": {
        "required": [ "max-flows-per-thread", "max-idle-flows-per-thread", "reader-thread-count", "flow-scan-interval", "generic-max-idle-time", "icmp-max-idle-time", "udp-max-idle-time", "tcp-max-idle-time", "max-packets-per-flow-to-send", "max-packets-per-flow-to-process", "max-packets-per-flow-to-analyse" ]
    },
    "if": {
        "properties": { "daemon_event_name": { "enum": [ "status", "shutdown" ] } }
    },
    "then": {
        "required": [ "packets-captured", "packets-processed", "pfring_active", "pfring_recv", "pfring_drop", "pfring_shunt", "total-skipped-flows", "total-l4-payload-len", "total-not-detected-flows", "total-guessed-flows", "total-detected-flows", "total-detection-updates", "total-updates", "current-active-flows", "total-active-flows", "total-idle-flows", "total-compressions", "total-compression-diff", "current-compression-diff", "global-alloc-bytes", "global-alloc-count", "global-free-bytes", "global-free-count", "total-events-serialized" ]
    },
    "properties": {
        "alias": {
            "type": "string"
        },
        "uuid": {
            "type": "string"
        },
        "source": {
            "type": "string"
        },
        "thread_id": {
            "type": "number",
            "minimum": 0,
            "maximum": 31
        },
        "packet_id": {
            "type": "number",
            "minimum": 0
        },
        "daemon_event_id": {
            "type": "number",
            "minimum": 0,
            "maximum": 4
        },
        "daemon_event_name": {
            "type": "string",
            "enum": [
                "invalid",
                "init",
                "reconnect",
                "shutdown",
                "status"
            ]
        },
        "version": {
            "type": "string"
        },
        "ndpi_version": {
            "type": "string"
        },
        "ndpi_api_version": {
            "type": "number",
            "minimum": 11500
        },
        "size_per_flow": {
            "type": "number",
            "minimum": 1400,
            "maximum": 1500
        },

        "max-flows-per-thread": {
            "type": "number"
        },
        "max-idle-flows-per-thread": {
            "type": "number"
        },
        "reader-thread-count": {
            "type": "number"
        },
        "flow-scan-interval": {
            "type": "number"
        },
        "generic-max-idle-time": {
            "type": "number"
        },
        "icmp-max-idle-time": {
            "type": "number"
        },
        "udp-max-idle-time": {
            "type": "number"
        },
        "tcp-max-idle-time": {
            "type": "number"
        },
        "max-packets-per-flow-to-process": {
            "type": "number"
        },
        "max-packets-per-flow-to-send": {
            "type": "number"
        },
        "max-packets-per-flow-to-analyse": {
            "type": "number"
        },

        "packets-captured": {
            "type": "number",
            "minimum": 0
        },
        "packets-processed": {
            "type": "number",
            "minimum": 0
        },
        "pfring_active": {
            "type": "boolean"
        },
        "pfring_recv": {
            "type": "number",
            "minimum": 0
        },
        "pfring_drop": {
            "type": "number",
            "minimum": 0
        },
        "pfring_shunt": {
            "type": "number",
            "minimum": 0
        },
        "total-skipped-flows": {
            "type": "number",
            "minimum": 0
        },
        "total-l4-payload-len": {
            "type": "number",
            "minimum": 0
        },
        "total-not-detected-flows": {
            "type": "number",
            "minimum": 0
        },
        "total-guessed-flows": {
            "type": "number",
            "minimum": 0
        },
        "total-detected-flows": {
            "type": "number",
            "minimum": 0
        },
        "total-detection-updates": {
            "type": "number",
            "minimum": 0
        },
        "total-updates": {
            "type": "number",
            "minimum": 0
        },
        "current-active-flows": {
            "type": "number",
            "minimum": 0
        },
        "total-active-flows": {
            "type": "number",
            "minimum": 0
        },
        "total-idle-flows": {
            "type": "number",
            "minimum": 0
        },
        "total-compressions": {
            "type": "number",
            "minimum": 0
        },
        "total-compression-diff": {
            "type": "number",
            "minimum": 0
        },
        "current-compression-diff": {
            "type": "number",
            "minimum": 0
        },
        "global-alloc-bytes": {
            "type": "number",
            "minimum": 0
        },
        "global-alloc-count": {
            "type": "number",
            "minimum": 0
        },
        "global-free-bytes": {
            "type": "number",
            "minimum": 0
        },
        "global-free-count": {
            "type": "number",
            "minimum": 0
        },
        "total-events-serialized": {
            "type": "number",
            "minimum": 1
        },
        "global_ts_usec": {
            "type": "number",
            "if": {
                "properties": { "daemon_event_name": { "enum": [ "init" ] } }
            },
            "then" : true,
            "else" : {
                "minimum": 1000000
            }
        }
    },
    "additionalProperties": false
}
