{
    "$schema": "http://json-schema.org/draft-09/schema#",
    "$id": "http://example.com/linking.schema.json",
    "title": "Motorcortex Linking Interface",
    "description": "Motorcortex Linking Interface",
    "type": "object",
    "properties": {
        "Version": {
            "type": "string",
            "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
        },
        "Groups": {
            "type": "array",
            "items": {
                "$ref": "#/definitions/Group"
            }
        }
    },
    "definitions": {
        "Path0": {
            "type": "object",
            "description": "Path of motorcortex variable with additional options",
            "required": [
                "Path"
            ],
            "properties": {
                "Path": {
                    "type": "string"
                },
                "Index": {
                    "type": "number"
                },
                "Length": {
                    "type": "number"
                }
            }
        },
        "Path": {
            "allOf": [
                {
                    "$ref": "#/definitions/Path0"
                }
            ],
            "unevaluatedProperties": false
        },
        "SetParameter": {
            "allOf": [
                {
                    "$ref": "#/definitions/Path0"
                }
            ],
            "properties": {
                "Value": {
                    "type": "any"
                },
                "Force": {
                    "type": "boolean"
                }
            },
            "required": [
                "Value"
            ],
            "unevaluatedProperties": false
        },
        "Link": {
            "type": "object",
            "required": [
                "Source",
                "Destination"
            ],
            "properties": {
                "Source": {
                    "$ref": "#/definitions/Path"
                },
                "Destination": {
                    "$ref": "#/definitions/Path"
                },
                "Gain": {
                    "type": "number"
                },
                "Invert": {
                    "type": "boolean"
                },
                "Offset": {
                    "type": "number"
                }
            },
            "additionalProperties": false
        },
        "SystemMode": {
            "type": "string",
            "enum": [
                "All",
                "Production",
                "Simulation"
            ]
        },
        "Group": {
            "type": "object",
            "properties": {
                "Name": {
                    "type": "string"
                },
                "SystemMode": {
                    "$ref": "#/definitions/SystemMode"
                },
                "Enable": {
                    "type": "boolean"
                },
                "SetParameters": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/SetParameter"
                    }
                },
                "Links": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/Link"
                    }
                }
            },
            "additionalProperties": false
        }
    }
}