{
    "additionalProperties": true,
    "definitions": {
        "array_of_numbers": {
            "items": {
                "$ref": "#/definitions/nullable_number"
            },
            "type": "array"
        },
        "array_of_numbers_or_arrays": {
            "oneOf": [
                {
                    "$ref": "#/definitions/array_of_numbers"
                },
                {
                    "items": {
                        "$ref": "#/definitions/array_of_numbers"
                    },
                    "type": "array"
                }
            ]
        },
        "array_or_number": {
            "oneOf": [
                {
                    "$ref": "#/definitions/nullable_number"
                },
                {
                    "items": {
                        "$ref": "#/definitions/nullable_number"
                    },
                    "type": "array"
                }
            ]
        },
        "data_record": {
            "additionalProperties": true,
            "patternProperties": {
                "^@.*": {
                    "description": "Data Array Time Series Custom Feature",
                    "title": "Custom Feature Type 2"
                }
            },
            "properties": {
                "cx": {
                    "$ref": "#/definitions/array_of_numbers"
                },
                "cy": {
                    "$ref": "#/definitions/array_of_numbers"
                },
                "head": {
                    "oneOf": [
                        {
                            "oneOf": [
                                {
                                    "type": "null"
                                },
                                {
                                    "enum": [
                                        "L",
                                        "R",
                                        "?"
                                    ],
                                    "type": "string"
                                }
                            ]
                        },
                        {
                            "items": {
                                "oneOf": [
                                    {
                                        "type": "null"
                                    },
                                    {
                                        "enum": [
                                            "L",
                                            "R",
                                            "?"
                                        ],
                                        "type": "string"
                                    }
                                ]
                            },
                            "type": "array"
                        }
                    ]
                },
                "id": {
                    "type": "string"
                },
                "ox": {
                    "$ref": "#/definitions/array_of_numbers"
                },
                "oy": {
                    "$ref": "#/definitions/array_of_numbers"
                },
                "ptail": {
                    "$ref": "#/definitions/array_or_number"
                },
                "px": {
                    "$ref": "#/definitions/array_of_numbers_or_arrays"
                },
                "py": {
                    "$ref": "#/definitions/array_of_numbers_or_arrays"
                },
                "t": {
                    "$ref": "#/definitions/array_of_numbers"
                },
                "ventral": {
                    "oneOf": [
                        {
                            "oneOf": [
                                {
                                    "type": "null"
                                },
                                {
                                    "enum": [
                                        "CW",
                                        "CCW",
                                        "?"
                                    ],
                                    "type": "string"
                                }
                            ]
                        },
                        {
                            "items": {
                                "oneOf": [
                                    {
                                        "type": "null"
                                    },
                                    {
                                        "enum": [
                                            "CW",
                                            "CCW",
                                            "?"
                                        ],
                                        "type": "string"
                                    }
                                ]
                            },
                            "type": "array"
                        }
                    ]
                },
                "walk": {
                    "items": {
                        "$ref": "#/definitions/pixel_walk_record"
                    },
                    "type": "array"
                },
                "x": {
                    "$ref": "#/definitions/array_of_numbers_or_arrays"
                },
                "y": {
                    "$ref": "#/definitions/array_of_numbers_or_arrays"
                }
            },
            "required": [
                "id",
                "t",
                "x",
                "y"
            ],
            "type": "object"
        },
        "interpolate_metadata": {
            "properties": {
                "method": {
                    "type": "string"
                },
                "values": {
                    "$ref": "#/definitions/string_or_array_of_strings"
                }
            },
            "type": "object"
        },
        "nullable_number": {
            "oneOf": [
                {
                    "type": "number"
                },
                {
                    "type": "null"
                }
            ]
        },
        "pixel_walk_record": {
            "properties": {
                "4": {
                    "type": "string"
                },
                "n": {
                    "oneOf": [
                        {
                            "type": "number"
                        },
                        {
                            "items": {
                                "type": "number"
                            },
                            "minItems": 2,
                            "type": "array"
                        }
                    ]
                },
                "px": {
                    "items": {
                        "type": "number"
                    },
                    "minItems": 3,
                    "type": "array"
                }
            },
            "type": "object"
        },
        "software_metadata": {
            "properties": {
                "featureID": {
                    "description": "i.e. the lab strain designation followed by an optional suffix (e.g. '@OMG')",
                    "type": "string"
                },
                "settings": {},
                "tracker": {
                    "properties": {
                        "name": {
                            "type": "string"
                        },
                        "version": {
                            "description": "Supports semantic versioning (MAJOR.MINOR.PATCH) (http://semver.org/), written as a string, or any other string.",
                            "type": "string"
                        }
                    },
                    "type": "object"
                }
            },
            "type": "object"
        },
        "string_or_array_of_strings": {
            "oneOf": [
                {
                    "type": "string"
                },
                {
                    "items": {
                        "type": "string"
                    },
                    "type": "array"
                }
            ]
        }
    },
    "description": "A text-based data interchange format for *C. elegans* trackers. It is a constrained subset of JSON. It is designed to be both human and machine readable and to facilitate data exchange and inter-operability for worm tracking data that is independent of platform and the language used for implementation.",
    "patternProperties": {
        "^@.*": {
            "description": "Top-Level Custom Feature",
            "title": "Custom Feature Type 1"
        }
    },
    "properties": {
        "data": {
            "oneOf": [
                {
                    "$ref": "#/definitions/data_record"
                },
                {
                    "items": {
                        "$ref": "#/definitions/data_record"
                    },
                    "type": "array"
                }
            ]
        },
        "files": {
            "additionalProperties": false,
            "description": "For very long tracking experiments, it may be convenient to split a single experiment across multiple WCON files. To make it easier to reconstruct tracks across files, we support a 'files' object.",
            "properties": {
                "current": {
                    "type": "string"
                },
                "next": {
                    "oneOf": [
                        {
                            "type": "null"
                        },
                        {
                            "type": "string"
                        },
                        {
                            "items": {
                                "minLength": 1,
                                "type": "string"
                            },
                            "type": "array"
                        }
                    ]
                },
                "prev": {
                    "oneOf": [
                        {
                            "type": "null"
                        },
                        {
                            "type": "string"
                        },
                        {
                            "items": {
                                "minLength": 1,
                                "type": "string"
                            },
                            "type": "array"
                        }
                    ]
                }
            },
            "required": [
                "current"
            ],
            "type": "object"
        },
        "metadata": {
            "additionalProperties": true,
            "description": "Information about experimental conditions and software versions; critical for reproducibility across labs.",
            "properties": {
                "age": {
                    "type": "number"
                },
                "arena": {
                    "properties": {
                        "orientation": {
                            "type": "string"
                        },
                        "size": {
                            "oneOf": [
                                {
                                    "type": "number"
                                },
                                {
                                    "items": {
                                        "type": "string"
                                    },
                                    "minItems": 2,
                                    "type": "array"
                                }
                            ]
                        },
                        "style": {
                            "default": "petri",
                            "type": "string"
                        }
                    },
                    "type": "object"
                },
                "food": {
                    "type": "string"
                },
                "humidity": {
                    "type": "number"
                },
                "id": {
                    "type": "string"
                },
                "interpolate": {
                    "oneOf": [
                        {
                            "$ref": "#/definitions/interpolate_metadata"
                        },
                        {
                            "items": {
                                "$ref": "#/definitions/interpolate_metadata"
                            },
                            "type": "array"
                        }
                    ]
                },
                "lab": {
                    "type": "object"
                },
                "media": {
                    "type": "string"
                },
                "protocol": {
                    "$ref": "#/definitions/string_or_array_of_strings"
                },
                "sex": {
                    "enum": [
                        "hermaphrodite",
                        "male"
                    ],
                    "type": "string"
                },
                "software": {
                    "oneOf": [
                        {
                            "$ref": "#/definitions/software_metadata"
                        },
                        {
                            "items": {
                                "$ref": "#/definitions/software_metadata"
                            },
                            "type": "array"
                        }
                    ]
                },
                "stage": {
                    "enum": [
                        "L1",
                        "L2",
                        "L3",
                        "L4",
                        "adult",
                        "dauer"
                    ],
                    "type": "string"
                },
                "strain": {
                    "type": "string"
                },
                "temperature": {
                    "type": "number"
                },
                "timestamp": {
                    "format": "date-time",
                    "type": "string"
                },
                "who": {
                    "$ref": "#/definitions/string_or_array_of_strings"
                }
            },
            "type": "object"
        },
        "units": {
            "additionalProperties": {
                "type": "string"
            },
            "description": "Defines the dimensions (temporal, spatial, etc) of the experiment.",
            "properties": {
                "t": {
                    "type": "string"
                },
                "x": {
                    "type": "string"
                },
                "y": {
                    "type": "string"
                }
            },
            "required": [
                "t",
                "x",
                "y"
            ],
            "type": "object"
        }
    },
    "required": [
        "units",
        "data"
    ],
    "title": "Worm tracker Commons Object Notation (WCON)",
    "type": "object"
}