{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$id": "https://wheelnext.dev/variants.json",
    "title": "{name}-{version}-variants.json",
    "description": "Combined index metadata for wheel variants",
    "type": "object",
    "properties": {
        "default-priorities": {
            "description": "Default provider priorities",
            "type": "object",
            "properties": {
                "namespace": {
                    "description": "Default namespace priorities",
                    "type": "array",
                    "items": {
                        "type": "string",
                        "pattern": "^[a-z0-9_]+$"
                    },
                    "minItems": 1,
                    "uniqueItems": true
                },
                "feature": {
                    "description": "Default feature priorities (by namespace)",
                    "type": "object",
                    "patternProperties": {
                        "^[a-z0-9_]+$": {
                            "description": "Preferred features",
                            "type": "array",
                            "items": {
                                "type": "string",
                                "pattern": "^[a-z0-9_]+$"
                            },
                            "minItems": 0,
                            "uniqueItems": true
                        }
                    },
                    "additionalProperties": false,
                    "uniqueItems": true
                },
                "property": {
                    "description": "Default property priorities (by namespace)",
                    "type": "object",
                    "patternProperties": {
                        "^[a-z0-9_]+$": {
                            "description": "Default property priorities (by feature) name",
                            "type": "object",
                            "patternProperties": {
                                "^[a-z0-9_]+$": {
                                    "type": "array",
                                    "items": {
                                        "type": "string",
                                        "pattern": "^[a-z0-9_.]+$"
                                    },
                                    "minItems": 0,
                                    "uniqueItems": true
                                }
                            },
                            "additionalProperties": false,
                            "uniqueItems": true
                        }
                    },
                    "additionalProperties": false,
                    "uniqueItems": true
                }
            },
            "additionalProperties": false,
            "uniqueItems": true,
            "required": [
                "namespace"
            ]
        },
        "providers": {
            "description": "Mapping of namespaces to provider information",
            "type": "object",
            "patternProperties": {
                "^[A-Za-z0-9_]+$": {
                    "type": "object",
                    "description": "Provider information",
                    "properties": {
                        "plugin-api": {
                            "description": "Object reference to plugin class",
                            "type": "string",
                            "pattern": "^([a-zA-Z0-9._]+ *: *[a-zA-Z0-9._]+)|([a-zA-Z0-9._]+)$"
                        },
                        "enable-if": {
                            "description": "Environment marker specifying when to enable the plugin",
                            "type": "string",
                            "minLength": 1
                        },
                        "optional": {
                            "description": "Whether the provider is optional",
                            "type": "boolean"
                        },
                        "plugin-use": {
                            "description": "Whether a plugin is used: not at all, at build time or both at build and install time",
                            "type": "string",
                            "enum": [
                                "none",
                                "build",
                                "all"
                            ]
                        },
                        "requires": {
                            "description": "Dependency specifiers for how to install the plugin",
                            "type": "array",
                            "items": {
                                "type": "string",
                                "minLength": 1
                            },
                            "minItems": 0,
                            "uniqueItems": true
                        }
                    },
                    "additionalProperties": false,
                    "uniqueItems": true,
                    "required": [
                        "requires"
                    ]
                }
            },
            "additionalProperties": false,
            "uniqueItems": true
        },
        "variants": {
            "description": "Mapping of variant labels to properties",
            "type": "object",
            "patternProperties": {
                "^[a-z0-9_.]{1,16}$": {
                    "type": "object",
                    "description": "Mapping of namespaces in a variant",
                    "patternProperties": {
                        "^[a-z0-9_.]+$": {
                            "patternProperties": {
                                "^[a-z0-9_.]+$": {
                                    "description": "list of possible values for this variant feature.",
                                    "type": "array",
                                    "items": {
                                        "type": "string",
                                        "pattern": "^[a-z0-9_.]+$"
                                    },
                                    "minItems": 1,
                                    "uniqueItems": true
                                }
                            },
                            "uniqueItems": true,
                            "additionalProperties": false
                        }
                    },
                    "uniqueItems": true,
                    "additionalProperties": false
                }
            },
            "additionalProperties": false,
            "uniqueItems": true
        }
    },
    "required": [
        "default-priorities",
        "providers",
        "variants"
    ],
    "uniqueItems": true
}