{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "FermiHDI Ingester Configuration",
  "type": "object",
  "properties": {
    "ingression_type": {
      "type": "string",
      "enum": ["kafka", "rabbitmq", "mqtt", "file", "s3"],
      "default": "kafka"
    },
    "input_format": {
      "type": "string",
      "enum": ["json", "rowbinary", "csv"],
      "default": "json"
    },
    "schema_file": {
      "type": "string",
      "default": "dataset_schema.json"
    },
    "batch_interval_seconds": {
      "type": ["integer", "null"]
    },
    "batch_id_field": {
      "type": "string",
      "default": ""
    },
                "round_batch_id_field": {
                    "description": "If true, rounds the extracted batch ID to the time index interval.",
                    "type": "boolean"
                },
    "tcp_max_session_duration_sec": {
      "type": "integer",
      "default": 600
    },
    "env": {
      "type": "string",
      "enum": ["production", "development"],
      "default": "production"
    },
    "node_name": {
      "type": "string",
      "default": "default-node"
    },
    "log_level": {
      "type": "string",
      "enum": ["DEBUG", "INFO", "WARN", "ERROR"],
      "default": "INFO"
    },
    "otel_collector_url": {
      "type": "string",
      "default": ""
    },
    "dms_url": {
      "type": "string",
      "default": "http://dms:6986"
    },
    "healthcheck_port": {
      "type": "integer",
      "default": 6986
    },
    "command_interface": {
      "type": "string",
      "description": "The IPv4 interface for the Command Network to bind to.",
      "default": "0.0.0.0"
    },
    "command_port": {
      "type": "integer",
      "description": "The primary operational TCP port over which the SCC pushes mTLS-secured query batches.",
      "default": 6986
    },
    "observability_interface": {
      "type": "string",
      "description": "The IPv4 interface for the Observability Network to bind to.",
      "default": "0.0.0.0"
    },
    "observability_port": {
      "type": "integer",
      "description": "Unsecured HTTP healthcheck server and telemetry metrics endpoint.",
      "default": 8080
    },
    "production_interface": {
      "type": "string",
      "description": "The physical PCIe network interface bound to the VFIO kernel module used for fast-path DPDK packet RX/TX. If 'none', uses posix system stack.",
      "default": "none"
    },
    "production_ip": {
      "type": "string",
      "description": "The IPv4 interface to bind DPDK/Seastar POSIX fallbacks onto.",
      "default": "0.0.0.0"
    },
    "production_port": {
      "type": "integer",
      "description": "The operational data ingress/egress port to bind the Production fast-path onto.",
      "default": 8000
    },
    "opt_in": {
      "type": "boolean",
      "default": false
    },
    "scc_targets": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "address": { "type": "string" },
          "port": { "type": "integer" },
          "description": { "type": "string" }
        },
        "required": ["address", "port"]
      }
    },
    "target_storage_clusters": {
      "type": "array",
      "items": { "type": "string" },
      "description": "Manual list of Storage Cluster IDs to target. If empty, defaults to all active SCs in the instance."
    },
    "kafka": {
      "type": "object",
      "properties": {
        "brokers": {"type": "string"},
        "topic": {"type": "string"},
        "group_id": {"type": "string"}
      }
    },
    "rabbitmq": {
      "type": "object",
      "properties": {
        "url": {"type": "string"},
        "queue": {"type": "string"}
      }
    },
    "mqtt": {
      "type": "object",
      "properties": {
        "address": {"type": "string"},
        "client_id": {"type": "string"},
        "topic": {"type": "string"}
      }
    },
    "file": {
      "type": "object",
      "properties": {
        "directory": {"type": "string"}
      }
    },
    "s3": {
      "type": "object",
      "properties": {
        "bucket": {"type": "string"},
        "prefix": {"type": "string"},
        "region": {"type": "string"},
        "access_key_id": {"type": "string"},
        "secret_access_key": {"type": "string"},
        "endpoint": {"type": "string"}
      }
    },
    "sc_status": {
      "type": "string",
      "description": "Indicates the explicit upstream Operational Status of the bounded logical Storage Cluster.",
      "default": "Active"
    },
    "webhooks": {
      "type": "array",
      "description": "Optional list of WebHook endpoints to notify upon significant node lifecycle events.",
      "items": {
        "type": "object",
        "properties": {
          "url": { "type": "string", "format": "uri" },
          "events": { 
            "type": "array",
            "items": { "type": "string" }
          },
          "headers": { 
             "type": "object", 
             "additionalProperties": { "type": "string" }
          }
        },
        "required": ["url"]
      }
    }
  }
}
