{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "Configuration",
    "description": "A configuration file for hint",
    "type": "object",
    "definitions": {
        "errorlevelstring": {
            "type": "string",
            "enum": [
                "off",
                "hint",
                "information",
                "warning",
                "error",
                "default"
            ]
        },
        "errorlevelnumber": {
            "type": "number",
            "enum": [
                0,
                1,
                2,
                3,
                4,
                5
            ]
        },
        "hintconfig": {
            "type": "array",
            "items": [
                {
                    "anyOf": [
                        {
                            "$ref": "#/definitions/errorlevelstring"
                        },
                        {
                            "$ref": "#/definitions/errorlevelnumber"
                        }
                    ]
                },
                {
                    "type": [
                        "object",
                        "array"
                    ]
                }
            ],
            "maxItems": 2,
            "minItems": 1,
            "uniqueItems": true
        },
        "hintobject": {
            "type": "object",
            "patternProperties": {
                "^.+$": {
                    "anyOf": [
                        {
                            "$ref": "#/definitions/errorlevelstring"
                        },
                        {
                            "$ref": "#/definitions/errorlevelnumber"
                        },
                        {
                            "$ref": "#/definitions/hintconfig"
                        }
                    ]
                }
            },
            "minItems": 1,
            "uniqueItems": true
        },
        "connector": {
            "description": "The connector to use to gather information",
            "anyOf": [
                {
                    "type": "object",
                    "properties": {
                        "name": {
                            "description": "The name of the connector to use",
                            "type": "string"
                        },
                        "options": {
                            "description": "The options to pass to the connector",
                            "type": "object"
                        }
                    },
                    "required": [
                        "name"
                    ]
                },
                {
                    "type": "string"
                }
            ]
        },
        "extends": {
            "description": "Base configuration to use.",
            "type": "array",
            "items": {
                "type": "string",
                "pattern": "^(?!all$).*$"
            },
            "uniqueItems": true
        },
        "formatters": {
            "description": "The formatter(s) to use for the results",
            "type": "array",
            "items": {
                "type": "string"
            },
            "uniqueItems": true
        },
        "parsers": {
            "description": "The parsers to be used with the connector to gather information for specific file types",
            "type": "array",
            "items": {
                "type": "string"
            },
            "uniqueItems": true
        },
        "hintsTimeout": {
            "description": "Time in milliseconds that a hint has to finish",
            "type": "number"
        },
        "hints": {
            "description": "The hints to validate",
            "anyOf": [
                {
                    "$ref": "#/definitions/hintobject"
                },
                {
                    "type": "array",
                    "items": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "array",
                                "items": [
                                    {
                                        "type": "string"
                                    },
                                    {
                                        "type": "object"
                                    }
                                ],
                                "minItems": 2,
                                "maxItems": 2
                            }
                        ]
                    },
                    "minItems": 1
                }
            ],
            "minItems": 1,
            "uniqueItems": true
        },
        "browserslist": {
            "description": "The browsers supported",
            "anyOf": [
                {
                    "type": "array",
                    "items": {
                        "type": "string"
                    },
                    "uniqueItems": true
                },
                {
                    "type": "string"
                }
            ]
        },
        "ignoredUrls": {
            "description": "The urls to ignore by the hints",
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "domain": {
                        "type": "string",
                        "description": "Regex for the domain to ignore"
                    },
                    "hints": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "uniqueItems": true
                    }
                },
                "required": [
                    "domain",
                    "hints"
                ]
            },
            "uniqueItems": true
        },
        "language": {
            "description": "Localization language",
            "type": "string"
        },
        "severityThreshold": {
            "$ref": "#/definitions/errorlevelstring"
        }
    },
    "properties": {
        "connector": {
            "$ref": "#/definitions/connector"
        },
        "extends": {
            "$ref": "#/definitions/extends"
        },
        "parsers": {
            "$ref": "#/definitions/parsers"
        },
        "formatters": {
            "$ref": "#/definitions/formatters"
        },
        "hintsTimeout": {
            "$ref": "#/definitions/hintsTimeout"
        },
        "hints": {
            "$ref": "#/definitions/hints"
        },
        "browserslist": {
            "$ref": "#/definitions/browserslist"
        },
        "ignoredUrls": {
            "$ref": "#/definitions/ignoredUrls"
        },
        "language": {
            "$ref": "#/definitions/language"
        },
        "severityThreshold": {
            "$ref": "#/definitions/severityThreshold"
        }
    },
    "anyOf": [
        {
            "required": [
                "connector",
                "hints"
            ]
        },
        {
            "required": [
                "extends"
            ]
        }
    ],
    "additionalProperties": false
}
