{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "$id": "dvrk-system.schema.json",
    "$version": "1",
    "title": "dVRK system",
    "type": "object",
    "description": "Configuration file format for the dVRK system.\n\n - This format is used by the application `sawIntuitiveResearchKitSystem` and the ROS application `dvrk_robot dvrk_system`\n - For details of implementation, see code under `sawIntuitiveResearchKit/core/components/code/system.cpp`\n - [Schema file](dvrk-system.schema.json)",
    "additionalProperties": false,
    "required": ["$id", "$version"],

    "properties": {

	"$id": {
	    "type": "string",
	    "description": "Schema used for this configuration file",
	    "enum": ["dvrk-system.schema.json"]
	},
	"$version": {
	    "type": "string",
	    "description": "Schema version"
	},

        "IOs": {
            "type": "array",
            "description": "List of IO components. Each IO (input/output) component corresponds to a physical connection to a set of dVRK controllers, usually over FireWire or Ethernet (UDP). IO components/ports are identified by their name once declared.",
            "items": {
                "type": "object",
                "description": "Configuration for a single IO component/port",
                "$ref": "dvrk-IO.schema.json"
            },
            "examples":
            [
                {
                    "name": "IO1",
                    "port": "fw"
                }
            ]
        },

        "arms": {
            "type": "array",
            "description": "List of arms for the system. Arms can be native, i.e. dVRK supported retired da Vinci arms, or compatible arms (with CRTK interface) created using the *cisst* `component_manager` section of the system configuration",
            "items": {
                "type": "object",
                "description": "Configuration for a single arm proxy",
                "$ref": "dvrk-system-arm.schema.json"
            }
        },

        "consoles": {
            "type": "array",
            "description": "List of consoles (as in surgeon's console). A dVRK system can have multiple consoles to control (teleoperate) a single patient's cart.\n\n Each console is defined by the IOs used for the clutch and camera pedals as well as the sensor used to detect operator presence.\n Within the console, two lists are used to declare the teleoperation components to be created (PSM and ECM teleoperation).\n All the arms and IOs used in the console must be declared at the top level of the system configuration file.",
            "items": {
                "type": "object",
                "description": "Configuration for a single console",
                "$ref": "dvrk-console.schema.json"
            }
        },

        "settings": {
            "description": "General settings for the dVRK system configuration.",
            "type": "object",
            "$ref": "dvrk-system-settings.schema.json"
        },

        "ISI_focus_controller": {
            "description": "Configuration required to use the da Vinci endoscope focus controller. This requires a custom cable and will only work with the original da Vinci focus controller (Classic and S, not Si). The configuration depends on which dVRK controller you connected the focus controller, different files are provided in `share/io` for your convenience. This setting will:\n - add a component to send focus in/out commands to the focus controller\n - connect (in software) the foot pedals cam+/- to change focus\n - add a Qt widget and ROS topics\nUsers can still change to focus using the +/- buttons on the controller itself.",
            "type": "object",
            "additionalProperties": false,
            "type": "object",
            "$ref": "dvrk-IO-configuration.schema.json",
            "examples": [
                {
                    "ISI_focus_controller": {
                        "IO": "IO1",
                        "IO_file": "io/sawRobotIO1394-MTML-dv-endoscope-focus.json"
                    }
                }
            ]
        },

        "component_manager": {
            "description": "Section used to dynamically create and connect cisst/SAW components to be used along the dVRK system. See *cisstMultiTask* [component manager](cisst-component-manager.html)",
            "$ref": "cisst-component-manager.schema.json"
        }
    }
}
