{
    "type": "object",
    "required": [
        "alias",
        "source",
        "packet_id",
        "packet_event_id",
        "packet_event_name",
        "pkt_datalink",
        "pkt_caplen",
        "pkt_type",
        "pkt_l3_offset",
        "pkt_l4_offset",
        "pkt_len",
        "pkt_l4_len",
        "thread_ts_usec"
    ],

    "dependencies" : {
        "flow_id" : [ "flow_packet_id", "flow_src_last_pkt_time", "flow_dst_last_pkt_time", "flow_idle_time" ]
    },

    "if": {
        "properties": { "packet_event_name": { "enum": ["packet-flow"] } }
    },
    "then": {
        "required": [ "thread_id", "flow_id", "flow_packet_id", "flow_src_last_pkt_time", "flow_dst_last_pkt_time", "flow_idle_time" ]
    },
    "else": {
        "not": { "required": [ "thread_id", "flow_id", "flow_packet_id", "flow_src_last_pkt_time", "flow_dst_last_pkt_time", "flow_idle_time" ] }
    },

    "properties": {
        "alias": {
            "type": "string"
        },
        "source": {
            "type": "string"
        },
        "thread_id": {
            "type": "number"
        },
        "packet_id": {
            "type": "number",
            "minimum": 0
        },
        "packet_event_id": {
            "type": "number",
            "minimum": 0,
            "maximum": 2
        },
        "packet_event_name": {
            "type": "string",
            "enum": [
                "invalid",
                "packet",
                "packet-flow"
            ]
        },
        "flow_id": {
            "type": "number",
            "minimum": 1
        },
        "flow_packet_id": {
            "type": "number"
        },
        "flow_src_last_pkt_time": {
            "type": "number",
            "minimum": 0
        },
        "flow_dst_last_pkt_time": {
            "type": "number",
            "minimum": 0
        },
        "flow_idle_time": {
            "type": "number",
            "minimum": 1
        },
        "pkt_datalink": {
            "type": "number",
            "minimum": 0,
            "maximum": 292
        },
        "pkt_caplen": {
            "type": "number",
            "minimum": 1,
            "maximum": 65535
        },
        "pkt_type": {
            "type": "number",
            "minimum": 0,
            "maximum": 65535
        },
        "pkt_l3_offset": {
            "type": "number",
            "minimum": 0,
            "maximum": 65535
        },
        "pkt_l4_len": {
            "type": "number",
            "minimum": 0,
            "maximum": 65535
        },
        "thread_ts_usec": {
            "type": "number",
            "minimum": 0
        },
        "pkt_l4_offset": {
            "type": "number",
            "minimum": 0,
            "maximum": 65535
        },
        "pkt_len": {
            "type": "number",
            "minimum": 0
        },
        "pkt": {
            "type": "string"
        }
    },
    "additionalProperties": false
}
