{
    "$id": "https://schemas.3d.si.edu/voyager/setup.schema.json",
    "$schema": "http://json-schema.org/draft-07/schema#",

    "title": "Setup",
    "description": "Tours and settings for explorer documents (background, interface, etc.)",

    "definitions": {
        "viewer": {
            "type": "object",
            "properties": {
                "shader": {
                    "type": "string"
                },
                "exposure": {
                    "type": "number"
                },
                "toneMapping": {
                    "type": "boolean"
                },
                "gamma": {
                    "type": "number"
                },
                "annotationsVisible": {
                    "type": "boolean"
                },
                "isWallMountAR": {
                    "type": "boolean"
                },
                "arScale": {
                    "type": "number"
                },
                "activeTags": {
                    "type": "string"
                },
                "sortedTags": {
                    "type": "string"
                },
                "radioTags": {
                    "type": "boolean"
                }
            },
            "required": [
                "shader",
                "exposure",
                "gamma"
            ]
        },
        "reader": {
            "type": "object",
            "properties": {
                "enabled": {
                    "type": "boolean"
                },
                "position": {
                    "type": "string"
                },
                "articleId": {
                    "description": "Id of the article currently displayed in the reader.",
                    "type": "string",
                    "minLength": 1
                }
            }
        },
        "interface": {
            "type": "object",
            "properties": {
                "visible": {
                    "type": "boolean"
                },
                "logo": {
                    "type": "boolean"
                },
                "menu": {
                    "type": "boolean"
                },
                "tools": {
                    "type": "boolean"
                }
            }
        },
        "navigation": {
            "type": "object",
            "properties": {
                "type": {
                    "type": "string",
                    "enum": [
                        "Orbit", "Fly", "Walk"
                    ]
                },
                "enabled": {
                    "type": "boolean"
                },
                "autoZoom": {
                    "type": "boolean"
                },
                "autoRotation": {
                    "type": "boolean"
                },
                "lightsFollowCamera": {
                    "type": "boolean"
                },
                "orbit": {
                    "$comment": "TODO: Implement",

                    "type": "object",
                    "properties": {

                    }
                },
                "walk": {
                    "$comment": "TODO: Implement",

                    "type": "object",
                    "properties": {
                    }
                }
            }
        },
        "background": {
            "type": "object",
            "properties": {
                "style": {
                    "type": "string",
                    "enum": [
                        "Solid", "LinearGradient", "RadialGradient"
                    ]
                },
                "color0": {
                    "$ref": "./common.schema.json#/definitions/vector3"
                },
                "color1": {
                    "$ref": "./common.schema.json#/definitions/vector3"
                }
            }
        },
        "floor": {
            "type": "object",
            "properties": {
                "visible": {
                    "type": "boolean"
                },
                "position": {
                    "$ref": "./common.schema.json#/definitions/vector3"
                },
                "size": {
                    "type": "number"
                },
                "color": {
                    "$ref": "./common.schema.json#/definitions/vector3"
                },
                "opacity": {
                    "type": "number"
                },
                "receiveShadow": {
                    "type": "boolean"
                },
                "autoSize": {
                    "type": "boolean"
                }
            }
        },
        "grid": {
            "type": "object",
            "properties": {
                "visible": {
                    "type": "boolean"
                },
                "color": {
                    "$ref": "./common.schema.json#/definitions/vector3"
                }
            }
        },
        "tape": {
            "type": "object",
            "properties": {
                "enabled": {
                    "type": "boolean"
                },
                "startPosition": {
                    "$ref": "./common.schema.json#/definitions/vector3"
                },
                "startDirection": {
                    "$ref": "./common.schema.json#/definitions/vector3"
                },
                "endPosition": {
                    "$ref": "./common.schema.json#/definitions/vector3"
                },
                "endDirection": {
                    "$ref": "./common.schema.json#/definitions/vector3"
                }
            }
        },
        "slicer": {
            "type": "object",
            "properties": {
                "enabled": {
                    "type": "boolean"
                },
                "axis": {
                    "type": "string",
                    "enum": [ "X", "Y", "Z" ]
                },
                "inverted": {
                    "type": "boolean"
                },
                "position": {
                    "type": "number"
                },
                "color": {
                    "$ref": "./common.schema.json#/definitions/vector3"
                }
            }
        },
        "audio": {
            "type": "object",
            "properties": {
                "narrationId": {
                    "type": "string"
                }
            }
        },
        "language": {
            "type": "object",
            "properties": {
                "language": {
                    "type": "string",
                    "enum": [
                        "EN", "ES", "DE", "NL", "JA", "FR", "HAW", "IT", "AR"
                    ]
                }
            }
        },
        "tours": {
            "description": "Animated tours.",
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "title": {
                        "type": "string"
                    },
                    "titles": {
                        "description": "Short title with language key.",
                        "type": "object"
                    },
                    "lead": {
                        "type": "string"
                    },
                    "leads": {
                        "description": "Short lead text with language key.",
                        "type": "object"
                    },
                    "tags": {
                        "description": "Array of tags, categorizing the tour.",
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "taglist": {
                        "description": "Array of tags, categorizing the annotation with language key.",
                        "type": "object"
                    },
                    "steps": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "title": {
                                    "type": "string"
                                },
                                "titles": {
                                    "description": "Short title with language key.",
                                    "type": "object"
                                },
                                "id": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                }
            }
        },
        "snapshots": {
            "description": "Snapshots are animatable scene states.",
            "type": "object",
            "properties": {
                "features": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "targets": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "states": {
                    "type": "array",
                    "items": {
                        "type": "object"
                    }
                }
            }
        }
    },

    "type": "object",
    "properties": {
        "units": {
            "$ref": "./common.schema.json#/definitions/units"
        },
        "interface": {
            "$ref": "#/definitions/interface"
        },
        "viewer": {
            "$ref": "#/definitions/viewer"
        },
        "reader": {
            "$ref": "#/definitions/reader"
        },
        "navigation": {
            "$ref": "#/definitions/navigation"
        },
        "background": {
            "$ref": "#/definitions/background"
        },
        "floor": {
            "$ref": "#/definitions/floor"
        },
        "grid": {
            "$ref": "#/definitions/grid"
        },
        "tape": {
            "$ref": "#/definitions/tape"
        },
        "slicer": {
            "$ref": "#/definitions/slicer"
        },
        "tours": {
            "$ref": "#/definitions/tours"
        },
        "language": {
            "$ref": "#/definitions/language"
        },
        "audio": {
            "$ref": "#/definitions/audio"
        }
    }
}
