{
  "$id": "https://schemas.sand.binaryedge.io/minion/modules/portscan",
  "title": "Portscan Module Body",
  "type": "object",
  "properties": {
    "portscanner": {
      "type": "string",
      "enum": [
        "be",
        "masscan",
        "noop"
      ]
    },
    "output": {
      "$comment": "Conditionals below may apply a module-specific schema to this object."
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "portscanner": {
            "const": "be"
          }
        }
      }
    },
    {
      "then": {
        "properties": {
          "output": {
            "$ref": "#/$defs/be"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "portscanner": {
            "const": "masscan"
          }
        }
      }
    },
    {
      "then": {
        "properties": {
          "output": {
            "$ref": "#/$defs/masscan"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "portscanner": {
            "const": "noop"
          }
        }
      }
    },
    {
      "then": {
        "properties": {
          "output": {
            "$ref": "#/$defs/noop"
          }
        }
      }
    }
  ],
  "$defs": {
    "be": {
      "type": "object",
      "properties": {
        "src_addr": {
          "$ref": "/minion/shared-types#/ip-address"
        },
        "src_port": {
          "$ref": "/minion/shared-types#/port-integer"
        },
        "reason": {
          "type": "string",
          "enum": [
            "none",
            "syn-ack",
            "udp-response"
          ]
        },
        "timestamp": {
          "$ref": "/minion/shared-types#/epoch-milliseconds-integer"
        },
        "response": {
          "type": "string"
        }
      },
      "required": [
        "src_addr",
        "src_port",
        "reason",
        "timestamp"
      ],
      "additionalProperties": false
    },
    "masscan": {
      "type": "object",
      "properties": {
        "reason": {
          "type": "string",
          "enum": [
            "none",
            "syn-ack"
          ]
        },
        "ttl": {
          "type": "integer"
        }
      },
      "required": [
        "reason",
        "ttl"
      ],
      "additionalProperties": false
    },
    "noop": {
      "type": "object",
      "properties": {
        "payload": {
          "description": "Optional arbitrary string included in results when configured.",
          "type": "string"
        }
      },
      "additionalProperties": false
    }
  },
  "required": [
    "portscanner"
  ],
  "additionalProperties": false
}
