{
    "$id": "https://cdn.jsdelivr.net/gh/Force-Organization-Army-Builder/fo_data_validator@2/schema/source-manifest.schema.json",
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object",
    "properties": {
        "$schema": {
            "description": "JSON Schema URL for editor support; ignored by Force Org",
            "allOf": [
                {
                    "$ref": "#/definitions/__schema0"
                }
            ]
        },
        "minValidatorVersion": {
            "description": "the oldest validator release that understands this source, as `major.minor.patch`, e.g. `1.14.0`; an older validator refuses the source with a message to update instead of reporting its newer fields as unknown. Set it to the release that added the newest feature the source uses. Validators before 1.14.0 do not know this field, so a value below 1.14.0 is never useful",
            "allOf": [
                {
                    "$ref": "#/definitions/__schema1"
                }
            ]
        },
        "schemaVersion": {
            "type": "number",
            "description": "data format version; the app refuses sources newer than it understands"
        },
        "expressionVersion": {
            "description": "the version of the expression language the source's expressions are written for; the app refuses sources newer than it understands. Left out, version 1 (with a warning)",
            "allOf": [
                {
                    "$ref": "#/definitions/__schema2"
                }
            ]
        },
        "name": {
            "type": "string"
        },
        "description": {
            "type": "string"
        },
        "disclaimer": {
            "description": "shown next to everything loaded from this source",
            "allOf": [
                {
                    "$ref": "#/definitions/__schema3"
                }
            ]
        },
        "provides": {
            "description": "complete games this source defines",
            "allOf": [
                {
                    "$ref": "#/definitions/__schema4"
                }
            ]
        },
        "extends": {
            "description": "games defined by another source that this source adds to",
            "allOf": [
                {
                    "$ref": "#/definitions/__schema10"
                }
            ]
        },
        "examples": {
            "description": "example lists the checker runs when the source loads (and in CI where adopted)",
            "allOf": [
                {
                    "$ref": "#/definitions/__schema12"
                }
            ]
        }
    },
    "required": [
        "schemaVersion",
        "name"
    ],
    "additionalProperties": false,
    "definitions": {
        "__schema0": {
            "type": "string"
        },
        "__schema1": {
            "type": "string",
            "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)$"
        },
        "__schema2": {
            "type": "number"
        },
        "__schema3": {
            "type": "string"
        },
        "__schema4": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "game": {
                        "$ref": "#/definitions/__schema5"
                    },
                    "factions": {
                        "$ref": "#/definitions/__schema6"
                    },
                    "subFactions": {
                        "$ref": "#/definitions/__schema8"
                    }
                },
                "required": [
                    "game",
                    "factions"
                ],
                "additionalProperties": false,
                "description": "File paths are relative to the manifest"
            }
        },
        "__schema5": {
            "type": "string",
            "description": "a `GameSystem` file"
        },
        "__schema6": {
            "type": "array",
            "items": {
                "$ref": "#/definitions/__schema7"
            },
            "description": "`Faction` files"
        },
        "__schema7": {
            "type": "string"
        },
        "__schema8": {
            "description": "`SubFaction` files",
            "allOf": [
                {
                    "$ref": "#/definitions/__schema9"
                }
            ]
        },
        "__schema9": {
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "__schema10": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "game": {
                        "type": "string",
                        "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
                        "description": "id of the extended game; bound to a loaded source that provides it (the user picks if several do)"
                    },
                    "versions": {
                        "type": "string",
                        "description": "A semver range a version must satisfy, e.g. `>=1.2.0 <2.0.0`"
                    },
                    "factions": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "subFactions": {
                        "description": "may name a parent faction from another source in the same game",
                        "allOf": [
                            {
                                "$ref": "#/definitions/__schema11"
                            }
                        ]
                    }
                },
                "required": [
                    "game",
                    "versions"
                ],
                "additionalProperties": false
            }
        },
        "__schema11": {
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "__schema12": {
            "type": "array",
            "items": {
                "type": "string"
            }
        }
    },
    "title": "SourceManifest"
}
