{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$id": "https://gitlab.com/algomus.fr/dezrann/dezrann-corpus/-/raw/positions/doc/schemas/positions.schema.json",
    "title": "Synchronized positions",
    "description": "Encoding positions in a image source",
    "type": "object",
    "properties": {
        "pages": {
            "description": "an array of pages",
            "type": "array",
            "items": {
                "description": "a page",
                "type": "object",
                "properties": {
                    "image": {
                        "description": "URL of the image of the page",
                        "type": "string"
                    },
                    "rows": {
                        "description": "a row in a page",
                        "type": "array",
                        "items": {
                            "description": "the coordinates of this row",
                            "type": "object",
                            "properties": {
                                "y": {
                                    "description": "start y",
                                    "type": "number"
                                },
                                "height": {
                                    "description": "height (y)",
                                    "type": "number"
                                },
                                "staves": {
                                    "type": "array",
                                    "items": {
                                        "description": "one staff",
                                        "type": "object",
                                        "properties": {
                                            "top": {
                                                "description": "staff top (y)",
                                                "type": "number"
                                            },
                                            "bottom": {
                                                "description": "staff bottom (y)",
                                                "type": "number"
                                            }
                                        },
                                        "required": [
                                            "top",
                                            "bottom"
                                        ]
                                    }
                                },
                                "start-x": {
                                    "description": "start x",
                                    "type": "number"
                                },
                                "end-x": {
                                    "description": "end x",
                                    "type": "number"
                                },
                                "onset-x": {
                                    "type": "array",
                                    "minItems": 2,
                                    "items": {
                                        "description": "one synchronization point",
                                        "type": "object",
                                        "properties": {
                                            "onset": {
                                                "description": "musical time (quarter notes), or seconds",
                                                "type": "number"
                                            },
                                            "x": {
                                                "description": "x position",
                                                "type": "number"
                                            }
                                        },
                                        "required": [
                                            "onset",
                                            "x"
                                        ]
                                    }
                                }
                            },
                            "required": [
                                "y",
                                "height",
                                "start-x",
                                "end-x",
                                "onset-x"
                            ]
                        }
                    }
                },
                "required": [
                    "image",
                    "rows"
                ]
            }
        }
    },
    "required": [
        "pages"
    ]
}