{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "version": "1.1.1",
    "type": "object",
    "properties": {
        "adventure": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "source": {
                        "type": "string"
                    },
                    "alAveragePlayerLevel": {
                        "description": "Adventurers League APL; for use in homebrew.",
                        "type": "integer"
                    },
                    "alLength": {
                        "description": "Adventurers League length (in hours); for use in homebrew.",
                        "type": "object",
                        "oneOf": [
                            {
                                "properties": {
                                    "min": {
                                        "type": "integer"
                                    },
                                    "max": {
                                        "type": "integer"
                                    }
                                }
                            },
                            {
                                "properties": {
                                    "exact": {
                                        "type": "integer"
                                    }
                                }
                            }
                        ]
                    },
                    "alId": {
                        "description": "Adventurers League ID; for use in homebrew.",
                        "type": "string"
                    },
                    "contents": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "name": {
                                    "type": "string"
                                },
                                "headers": {
                                    "type": "array",
                                    "items": {
                                        "oneOf": [
                                            {
                                                "type": "string"
                                            },
                                            {
                                                "type": "object",
                                                "properties": {
                                                    "depth": {
                                                        "type": "integer"
                                                    },
                                                    "header": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "depth",
                                                    "header"
                                                ]
                                            }
                                        ]
                                    }
                                },
                                "ordinal": {
                                    "type": "object",
                                    "properties": {
                                        "type": {
                                            "type": "string",
                                            "enum": [
                                                "chapter",
                                                "appendix",
                                                "part",
                                                "episode",
                                                "level"
                                            ]
                                        },
                                        "identifier": {
                                            "type": [
                                                "integer",
                                                "string"
                                            ]
                                        }
                                    },
                                    "additionalProperties": false,
                                    "required": [
                                        "type",
                                        "identifier"
                                    ]
                                }
                            },
                            "additionalProperties": false,
                            "required": [
                                "name"
                            ]
                        }
                    },
                    "level": {
                        "oneOf": [
                            {
                                "type": "object",
                                "properties": {
                                    "start": {
                                        "type": "integer"
                                    },
                                    "end": {
                                        "type": "integer"
                                    }
                                },
                                "additionalProperties": false,
                                "required": [
                                    "start",
                                    "end"
                                ]
                            },
                            {
                                "type": "object",
                                "properties": {
                                    "custom": {
                                        "type": "string"
                                    }
                                },
                                "additionalProperties": false,
                                "required": [
                                    "custom"
                                ]
                            }
                        ]
                    },
                    "published": {
                        "type": "string",
                        "format": "date"
                    },
                    "publishedOrder": {
                        "description": "A sorting order for adventures within a single source.",
                        "type": "integer"
                    },
                    "coverUrl": {
                        "type": "string"
                    },
                    "storyline": {
                        "type": "string",
                        "enum": [
                            "Starter Set",
                            "Tyranny of Dragons",
                            "Elemental Evil",
                            "Rage of Demons",
                            "Curse of Strahd",
                            "Storm King's Thunder",
                            "Tales from the Yawning Portal",
                            "Tomb of Annihilation",
                            "Waterdeep",
                            "Ravnica",
                            "Extra Life",
                            "Ghosts of Saltmarsh",
                            "Acquisitions Incorporated",
                            "Essentials Kit",
                            "Stranger Things",
                            "Baldur's Gate",
                            "Eberron",
                            "Rick and Morty",
                            "Wildemount"
                        ]
                    }
                },
                "additionalProperties": false,
                "required": [
                    "name",
                    "id",
                    "source",
                    "contents",
                    "level",
                    "published",
                    "storyline"
                ]
            }
        }
    },
    "additionalProperties": false
}