{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "title": "SimVT session file",
    "description": "Session file for SimVT tool",
    "type": "object",
    "properties": {
        "model_container_definitions": {
            "description": "Defines a model so it can be re-created from this information.",
            "type": "array",
            "items": {
                "type": "object",
                "additionalProperties": false,
                "required": ["type", "file_path", "model_tag"],
                "properties": {
                    "type": {
                        "description": "Type of model to be loaded in.",
                        "type": "string",
                        "enum": ["CSV config", "CSV data", "ISO-MME", "Workflow"]
                    },
                    "file_path": {
                        "description": "File path to relevant model file.",
                        "type": "string"
                    },
                    "csv_config_path": {
                        "description": "File path to CSV config file. Only used for model type 'CSV Config'",
                        "type": "string"
                    },
                    "unit_system": {
                        "description": "Unit system of input model. Only used for model types 'CSV Config' and 'ISO MME'",
                        "type": "string",
                        "enum": ["undefined", "U1", "U2", "U3", "U4", "U5", "U6"]
                    },
                    "drive_side": {
                        "description": "Drive side of input model. Only used for model types 'ISO MME'",
                        "type": "string",
                        "enum": ["LHD", "RHD"]
                    },
                    "model_tag": {
                        "description": "Model tag to be used for model.",
                        "type": "string"
                    },
                    "import_config": {
                        "description": "The JSON object that represents ImportConfigCSV CSV config data. Only used for model type 'CSV data' and 'ISO MME'",
                        "type": "object"
                    }
                }
            }
        },
        "cora_vars": {
            "type": "object"
        },
        "evaluation_intervals": {
            "type": "object"
        },
        "selected_channels_data": {
            "description": "Data about selected channels.",
            "type": "array",
            "items": {
                "type": "object",
                "additionalProperties": false,
                "required": ["ref", "sim"],
                "properties": {
                    "ref": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": ["model_tag", "channel"],
                        "properties": {
                            "model_tag": {
                                "description": "Reference model tag.",
                                "type": "string"
                            },
                            "channel": {
                                "description": "Channel code for reference model.",
                                "type": "string"
                            }
                        }
                    },
                    "sim": {
                        "description": "Array of simulation data. There will be one element for each correlation between a reference and simulation model.",
                        "type": "array",
                        "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": ["model_tag", "channel"],
                            "properties": {
                                "toggled": {
                                    "description": "If channel is toggled in the Correlation Table.",
                                    "type": "boolean"
                                },
                                "model_tag": {
                                    "description": "Model tag of simulation model.",
                                    "type": "string"
                                },
                                "channel": {
                                    "description": "Channel code for simulation model(s). These should all be identical.",
                                    "type": "string"
                                },
                                "simvt_operations": {
                                    "description": "A SimVTOperation object.",
                                    "type": "object",
                                    "additionalProperties": false,
                                    "properties": {
                                        "header_sim_MULY": {
                                            "description": "MULY operation for simulation model.",
                                            "type": "number"
                                        },
                                        "header_sim_ADDY": {
                                            "description": "ADDY operation for simulation model.",
                                            "type": "number"
                                        },
                                        "header_sim_MULX": {
                                            "description": "MULX operation for simulation model.",
                                            "type": "number"
                                        },
                                        "header_sim_ADDX": {
                                            "description": "ADDX operation for simulation model.",
                                            "type": "number"
                                        },
                                        "header_sim_FILTER": {
                                            "description": "FILTER operation for simulation model.",
                                            "type": "string",
                                            "enum": ["0", "A", "B", "C", "D"]
                                        },
                                        "header_ref_MULY": {
                                            "description": "MULY operation for simulation model.",
                                            "type": "number"
                                        },
                                        "header_ref_ADDY": {
                                            "description": "ADDY operation for simulation model.",
                                            "type": "number"
                                        },
                                        "header_ref_MULX": {
                                            "description": "MULX operation for simulation model.",
                                            "type": "number"
                                        },
                                        "header_ref_ADDX": {
                                            "description": "ADDX operation for simulation model.",
                                            "type": "number"
                                        },
                                        "header_ref_FILTER": {
                                            "description": "FILTER operation for simulation model.",
                                            "type": "string",
                                            "enum": [
                                                "?",
                                                "0",
                                                "1",
                                                "2",
                                                "3",
                                                "A",
                                                "B",
                                                "C",
                                                "D",
                                                "E",
                                                "F",
                                                "G",
                                                "H",
                                                "P",
                                                "Q",
                                                "S",
                                                "V",
                                                "X",
                                                "",
                                                "Unfiltered",
                                                "FIR 100",
                                                "COMBINED_A_AND_B",
                                                "COMBINED_B_AND_C",
                                                "CFC1000",
                                                "CFC600",
                                                "CFC180",
                                                "CFC60",
                                                "CFC1000",
                                                "CFC600",
                                                "CFC180",
                                                "CFC60",
                                                "PREFILTERED > CFC1000",
                                                "PREFILTERED < CFC60",
                                                "SPECIAL FILTER",
                                                "Data from film (video) analysis",
                                                "Without (Constant Channel)"
                                            ]
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "matching_rules": {
            "description": "Describes the channel matching rules.",
            "type": "array",
            "items": {
                "type": "object",
                "additionalProperties": false,
                "required": ["rule_string", "subject"],
                "properties": {
                    "rule_string": {
                        "description": "Rule string inputted by user.",
                        "type": "string"
                    },
                    "subject": {
                        "description": "Subject of the rule.",
                        "type": "string"
                    }
                }
            }
        },
        "default_layout": {
            "description": "Default layout of graphs after correlation.",
            "type": "object",
            "additionalProperties": false,
            "required": ["x", "y"],
            "properties": {
                "x": {
                    "description": "number of graphs in x direction.",
                    "type": "number",
                    "exclusiveMinimum": 0
                },
                "y": {
                    "description": "number of graphs in y direction.",
                    "type": "number",
                    "exclusiveMinimum": 0
                }
            }
        },
        "plot_corridor_graph": {
            "description": "If true, will plot corridor graph,",
            "type": "boolean"
        },
        "plot_crosscorrelation_graph": {
            "description": "If true, will plot cross-correlation graph",
            "type": "boolean"
        },
        "timebounds_on": {
            "description": "If true, will add time boundaries of the correlation analysis window.",
            "type": "boolean"
        },
        "show_legend": {
            "description": "Shows or hides legends of all plots.",
            "type": "boolean"
        },
        "add_scores_to_title": {
            "description": "If true, will add correlation and corridor ratings to graph.",
            "type": "boolean"
        },
        "add_scores_to_legend": {
            "description": "If true, will add correlation and corridor ratings to legend.",
            "type": "boolean"
        },
        "add_method_to_legend": {
            "description": "If true, adds rating method to legend.",
            "type": "boolean"
        },
        "add_cross_correlation_scores_to_corridor_legend": {
            "description": "If true, will add cross correlation scores to corridor graph legend.",
            "type": "boolean"
        },
        "protocol": {
            "description": "The name of the protocol that is used to define which channels are required as well as the regularisation interval, the t_max value from head excursion and the cora_vars method etc.",
            "type": "string"
        },
        "show_corridors": {
            "description": "If true, will show corridors (default is true - note that this property was added on 3/01/25).",
            "type": "boolean"
        },
        "combine_corridor_graphs": {
            "description": "If true, will combine corridor graphs with the same reference curve (default is false - note that this property was added on 06/05/2025).",
            "type": "boolean"
        },
        "dynamic_corridor_visualisation": {
            "description": "If true, adds vertical datums to show where sim curve out of bound.",
            "type": "boolean"
        },
        "show_time_of_poorest_correlation": {
            "description": "If true, highlight the time of poorest correlation.",
            "type": "boolean"
        },
        "show_start_of_divergence": {
            "description": "If true, highlight the start time of divergence leading to poorest correlation.",
            "type": "boolean"
        }
    },
    "additionalProperties": false,
    "required": ["model_container_definitions"]
}
