{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "OSTRICH-SWMM Config",
    "description": "A configuration for the OSTRICH-SWMM package.",
    "type": "object",
    "properties": {
        "binary_output_path": {
            "type": "string"
        },
        "input_template_path": {
            "type": "string",
            "minLength": 1
        },
        "input_parameters_path": {
            "type": "string",
            "minLength": 1
        },
        "input_path": {
            "type": "string",
            "minLength": 1
        },
        "report_output_path": {
            "type": "string",
            "minLength": 1
        },
        "swmm_path": {
            "type": "string",
            "minLength": 1
        },
        "summary_dir": {
            "type": "string"
        },
        "extract": {
            "type": "object",
            "properties": {
                "steps": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/extract_step"
                    }
                }
            },
            "required": [
                "steps"
            ]
        }
    },
    "definitions": {
        "extract_step": {
            "type": "object",
            "oneOf": [
                {
                    "$ref": "#/definitions/node_extract_step"
                }
            ],
            "properties": {
                "enabled": {
                    "type": "boolean"
                },
                "type": {
                    "type": "string"
                }
            },
            "required": [
                "type"
            ]
        },
        "node_extract_step": {
            "type": "object",
            "properties": {
                "event_threshold_flow_rate": {
                    "type": "number"
                },
                "type": {
                    "type": "string",
                    "pattern": "^node$"
                },
                "nodes": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "output_path": {
                    "type": "string"
                },
                "statistics": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/node_extract_statistic"
                    }
                }
            },
            "required": [
                "statistics",
                "nodes",
                "output_path"
            ]
        },
        "node_extract_statistic": {
            "enum": [
                "node_name",
                "num_flow_events",
                "total_flow_volume",
                "total_flow_duration",
                "first_flow_start",
                "first_flow_end",
                "first_flow_duration",
                "first_flow_volume",
                "last_flow_start",
                "last_flow_end",
                "last_flow_duration",
                "last_flow_volume",
                "max_volume_flow_start",
                "max_volume_flow_end",
                "max_volume_flow_duration",
                "max_volume_flow_volume",
                "max_duration_flow_start",
                "max_duration_flow_end",
                "max_duration_flow_duration",
                "max_duration_flow_volume"
            ]
        }
    }
}