{
    "title": "JSON schema for bsconfig.json configuration files",
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object",
    "dependencies": {
        "deploy": [
            "host",
            "password"
        ]
    },
    "definitions": {
        "diagnosticReporterValue": {
            "oneOf": [
                {
                    "type": "string",
                    "description": "Either a preset name ('detailed' or 'github-actions') or a custom template string containing at least one known placeholder."
                },
                {
                    "type": "object",
                    "required": ["type"],
                    "properties": {
                        "type": {
                            "type": "string",
                            "enum": ["detailed"]
                        }
                    },
                    "additionalProperties": false
                },
                {
                    "type": "object",
                    "required": ["type"],
                    "properties": {
                        "type": {
                            "type": "string",
                            "enum": ["github-actions"]
                        }
                    },
                    "additionalProperties": false
                },
                {
                    "type": "object",
                    "required": ["type", "format"],
                    "properties": {
                        "type": {
                            "type": "string",
                            "enum": ["custom"]
                        },
                        "format": {
                            "type": "string",
                            "description": "Template string. Supported placeholders: {file}, {line}, {col}, {endLine}, {endCol}, {severity}, {severityCode}, {code}, {message}, {source}."
                        }
                    },
                    "additionalProperties": false
                }
            ]
        }
    },
    "properties": {
        "extends": {
            "description": "Relative or absolute path to another bsconfig.json file that this file should use as a base and then override. Prefix with a question mark (?) to prevent throwing an exception if the file does not exist.",
            "type": "string"
        },
        "cwd": {
            "description": "A path that will be used to override the current working directory",
            "type": "string"
        },
        "rootDir": {
            "description": "The root directory of your Roku project. Defaults to the current working directory (or cwd property)",
            "type": "string"
        },
        "manifest": {
            "description": "A entry to modify manifest values",
            "type": "object",
            "properties": {
                "bs_const": {
                    "description": "A dictionary of bs_consts to change or add to the manifest. Each entry ",
                    "type": "object",
                    "patternProperties": {
                        "^.+$": {
                            "type": [
                                "boolean",
                                "null"
                            ]
                        }
                    }
                }
            }
        },
        "files": {
            "description": "The list of files that should be used in this project. Supports globs. Optionally, you can specify an object with `src` and `dest` properties to move files from one location into a different destination location",
            "default": [
                "manifest",
                "source/**/*.*",
                "components/**/*.*",
                "images/**/*.*"
            ],
            "type": "array",
            "items": {
                "anyOf": [
                    {
                        "type": "string",
                        "description": "A file path or file glob"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "src": {
                                "anyOf": [
                                    {
                                        "type": "string",
                                        "description": "A file path or glob pattern of source file(s)"
                                    },
                                    {
                                        "type": "array",
                                        "description": "An array of file path or globs",
                                        "items": {
                                            "type": "string",
                                            "description": "A file path or glob pattern of source file(s)"
                                        }
                                    }
                                ]
                            },
                            "dest": {
                                "type": "string",
                                "description": "The destination for the file(s) found in 'src'"
                            }
                        },
                        "required": [
                            "src",
                            "dest"
                        ]
                    }
                ]
            }
        },
        "outFile": {
            "description": "The path where the output zip or package should be placed. This includes the filename. Defaults to \"./out/package\"",
            "type": "string"
        },
        "createPackage": {
            "description": "Creates a zip package. Defaults to true. This setting is ignored when deploy is enabled.",
            "type": "boolean"
        },
        "sourceMap": {
            "description": "Enables generating sourcemap files, which allow debugging tools to show the original source code while running the emitted files.",
            "type": "boolean",
            "default": false
        },
        "relativeSourceMaps": {
            "description": "If true, source file paths in generated sourcemaps will be relative to the map file location instead of absolute. This makes sourcemaps portable across different machines and environments.",
            "type": "boolean",
            "default": false
        },
        "copyToStaging": {
            "description": "If true, the files are copied to staging. This setting is ignored when deploy is enabled or if createPackage is enabled",
            "type": "boolean"
        },
        "watch": {
            "description": "If true, the server will keep running and will watch and recompile on every file change",
            "type": "boolean",
            "default": false
        },
        "deploy": {
            "description": "If true, after a successful buld, the project will be deployed to the roku specified in host",
            "type": "boolean"
        },
        "host": {
            "description": "The host of the Roku that the package will be deploy to",
            "type": "string"
        },
        "username": {
            "description": "The username to use when deploying to a Roku device",
            "type": "string"
        },
        "password": {
            "description": " The password to use when deploying to a Roku device",
            "type": "string"
        },
        "retainStagingDir": {
            "type": "boolean",
            "description": "Prevent the staging folder from being deleted after the deployment package is created.  This is helpful for troubleshooting why your package isn't being created the way you expected.",
            "default": false
        },
        "retainStagingFolder": {
            "type": "boolean",
            "deprecated": true,
            "description": "Prevent the staging folder from being deleted after the deployment package is created.  This is helpful for troubleshooting why your package isn't being created the way you expected.",
            "default": false
        },
        "stagingDir": {
            "type": "string",
            "description": "The path to the staging folder (where all files are copied before creating the zip package)"
        },
        "stagingFolderPath": {
            "type": "string",
            "deprecated": true,
            "deprecationMessage": "Deprecated. Use `stagingDir` instead.",
            "description": "The path to the staging folder (where all files are copied before creating the zip package)"
        },
        "ignoreErrorCodes": {
            "description": "A list of error codes the compiler should NOT emit, even if encountered.",
            "type": "array",
            "deprecated": true,
            "deprecationMessage": "Deprecated. Use `diagnosticFilters` instead.",
            "items": {
                "anyOf": [
                    {
                        "type": "number",
                        "description": "A BrighterScript error code that will be ignored during compile"
                    }
                ]
            }
        },
        "diagnosticSeverityOverrides": {
            "description": "A map of error codes with their severity level override (error|warn|info)",
            "type": "object",
            "patternProperties": {
                ".{1,}": {
                    "type": [
                        "number",
                        "string"
                    ],
                    "enum": [
                        "error",
                        "warn",
                        "info",
                        "hint"
                    ]
                }
            }
        },
        "emitFullPaths": {
            "description": "Emit full paths to files when printing diagnostics to the console.",
            "type": "boolean",
            "default": false
        },
        "emitDefinitions": {
            "description": "Emit type definition files (`d.bs`) during transpile",
            "type": "boolean",
            "default": false
        },
        "removeParameterTypes": {
            "description": "Removes the explicit type to function's parameters and return (i.e. the `as type` syntax) ",
            "type": "boolean",
            "default": false
        },
        "diagnosticFilters": {
            "description": "A collection of filters used to hide diagnostics for certain files",
            "type": "array",
            "items": {
                "anyOf": [
                    {
                        "type": "number",
                        "description": "The code of a diagnostic that should be filtered from all files"
                    },
                    {
                        "type": "string",
                        "description": "A file path relative to rootDir, an absolute path, or a file glob pointing to file(s) you wish to filter diagnostics from."
                    },
                    {
                        "type": "object",
                        "description": "A file path relative to rootDir, an absolute path, or a file glob pointing to file(s) you wish to filter diagnostics from.",
                        "properties": {
                            "src": {
                                "type": "string",
                                "description": "A file path relative to rootDir, an absolute path, or a file glob pointing to file(s) you wish to filter diagnostics from."
                            },
                            "codes": {
                                "type": "array",
                                "description": "A list of codes of diagnostics that should be filtered out from the files matched in 'src'`. If omitted, all error codes are used",
                                "items": {
                                    "anyOf": [
                                        {
                                            "type": [
                                                "number",
                                                "string"
                                            ],
                                            "description": "A code of diagnostics that should be filtered out from the files matched in 'src'"
                                        }
                                    ]
                                }
                            }
                        }
                    }
                ]
            }
        },
        "plugins": {
            "description": "A list of node scripts or npm modules to add extra diagnostics or transform the AST.",
            "type": "array",
            "items": {
                "anyOf": [
                    {
                        "type": "string",
                        "description": "a path to a node script or an npm module to load dynamically"
                    }
                ]
            }
        },
        "require": {
            "description": "A list of scripts or modules to pass to node's `require()` on startup. This is useful for doing things like ts-node registration",
            "type": "array",
            "items": {
                "anyOf": [
                    {
                        "type": "string",
                        "description": "a path to a node script or an npm module to load dynamically at startup."
                    }
                ]
            }
        },
        "autoImportComponentScript": {
            "description": "When enabled, every xml component will search for a .bs or .brs file with the same name in the same folder, and add it as a script import if found. Disabled by default",
            "type": "boolean",
            "default": false
        },
        "logLevel": {
            "description": "The amount of detail that should be printed to the console",
            "type": "string",
            "default": "log",
            "enum": [
                "error",
                "warn",
                "log",
                "info",
                "debug",
                "trace"
            ]
        },
        "sourceRoot": {
            "description": "Override the root directory path where debugger should locate the source files. The location will be embedded in the source map to help debuggers locate the original source files. This only applies to files found within rootDir. This is useful when you want to preprocess files before passing them to BrighterScript, and want a debugger to open the original files. This option also affects the `SOURCE_FILE_PATH` and `SOURCE_LOCATION` source literals.",
            "type": "string"
        },
        "resolveSourceRoot": {
            "description": "Should the `sourceRoot` property be resolve to an absolute path (relative to the bsconfig it's defined in)",
            "type": "boolean",
            "default": false
        },
        "diagnosticLevel": {
            "description": "Specify what diagnostic levels are printed to the console. This has no effect on what diagnostics are reported in the LanguageServer. Defaults to 'warn'",
            "type": "string",
            "default": "log",
            "enum": [
                "hint",
                "info",
                "warn",
                "error"
            ]
        },
        "diagnosticReporters": {
            "description": "Specify how diagnostics are reported to the console. Accepts a single value or an array; each diagnostic is rendered once per entry. Each value is either a preset name ('detailed', 'github-actions'), a custom template string containing at least one known placeholder ({file}, {line}, {col}, {endLine}, {endCol}, {severity}, {severityCode}, {code}, {message}, {source}), or an object with explicit `type`. Defaults to 'detailed'.",
            "default": "detailed",
            "oneOf": [
                {
                    "$ref": "#/definitions/diagnosticReporterValue"
                },
                {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/diagnosticReporterValue"
                    }
                }
            ]
        },
        "allowBrighterScriptInBrightScript": {
            "description": "Allow brighterscript features (classes, interfaces, etc...) to be included in BrightScript (`.brs`) files, and force those files to be transpiled.",
            "type": "boolean",
            "default": false
        },
        "minFirmwareVersion": {
            "description": "The minimum Roku firmware version required to run this project. When set, BrightScript (.brs) files will be validated to ensure they only use language features available in that firmware version or earlier. BrighterScript (.bs) files are always allowed to use all features since they are transpiled. Should be a semver-compatible string (e.g. \"11.0.0\").",
            "type": "string",
            "examples": [
                "11.0.0",
                "12.0.0"
            ]
        }
    }
}
