{
    "$ref": "#/definitions/DictatableConfig",
    "$schema": "http://json-schema.org/draft-07/schema#",
    "definitions": {
        "DictatableConfig": {
            "additionalProperties": false,
            "description": "The root element of a dictatable configuration file.",
            "properties": {
                "actions": {
                    "description": "Actions to perform if triggered.",
                    "items": {
                        "$ref": "#/definitions/DictatableConfigAction"
                    },
                    "type": "array"
                },
                "message": {
                    "description": "Optional message. Can be used to explain this dictatable.",
                    "type": "string"
                },
                "triggers": {
                    "description": "Conditions that, if met, makes this dictatable run. Empty triggers means it will always run.",
                    "items": {
                        "$ref": "#/definitions/DictatableConfigTrigger"
                    },
                    "type": "array"
                }
            },
            "type": "object"
        },
        "DictatableConfigAction": {
            "additionalProperties": false,
            "properties": {
                "beSupersetOfJsonFile": {
                    "description": "A file that should contain a superset of the target file.",
                    "type": "string"
                },
                "chmod": {
                    "description": "The target should have this chmod.",
                    "type": "string"
                },
                "copyFrom": {
                    "description": "Can be a glob pattern to match many files or folders. Target will always be\nconsidered a folder preserving original filenames.",
                    "type": "string"
                },
                "haveJsonPathValues": {
                    "items": {
                        "$ref": "#/definitions/DictatableConfigActionExpression"
                    },
                    "type": "array"
                },
                "haveLineContaining": {
                    "description": "Will be added to the end of the file if not found.",
                    "items": {
                        "minimum": 1,
                        "type": "string"
                    },
                    "type": "array"
                },
                "haveLineContainingFile": {
                    "description": "Will be added to the end of the file if not found. This works just like haveLineContaining\nbut will respect the .dictatorConfig.json ignore.",
                    "items": {
                        "minimum": 1,
                        "type": "string"
                    },
                    "type": "array"
                },
                "itShould": {
                    "$ref": "#/definitions/DictatableConfigActionItShould",
                    "description": "A path that should EXIST or NOT_EXIST.",
                    "type": "string"
                },
                "message": {
                    "description": "Optional message. Can be used to explain this requirement.",
                    "type": "string"
                },
                "notHaveJsonPathNodes": {
                    "items": {
                        "type": "string"
                    },
                    "type": "array"
                },
                "target": {
                    "type": "string Can be a file or folder, if it does not exists it will be treated as a folder."
                }
            },
            "required": [
                "target"
            ],
            "type": "object"
        },
        "DictatableConfigActionEnvironmentVariable": {
            "additionalProperties": false,
            "description": "These may be used to make the tool behave differently, perhaps\ncopy or patch different files, depending on operating system.",
            "properties": {
                "name": {
                    "description": "Name of environment variable",
                    "type": "string"
                },
                "value": {
                    "description": "Optional value of variable",
                    "type": "string"
                }
            },
            "required": [
                "name"
            ],
            "type": "object"
        },
        "DictatableConfigActionExpression": {
            "additionalProperties": false,
            "properties": {
                "expression": {
                    "description": "Expression",
                    "type": "string"
                },
                "value": {
                    "description": "A value that should match.",
                    "type": "string"
                }
            },
            "required": [
                "expression"
            ],
            "type": "object"
        },
        "DictatableConfigActionItShould": {
            "enum": [
                "NOT_BE_IN_GIT",
                "NOT_EXIST"
            ],
            "type": "string"
        },
        "DictatableConfigTrigger": {
            "additionalProperties": false,
            "properties": {
                "and": {
                    "description": "And all these triggers.",
                    "items": {
                        "$ref": "#/definitions/DictatableConfigTrigger"
                    },
                    "type": "array"
                },
                "haveEnvironmentVariable": {
                    "$ref": "#/definitions/DictatableConfigActionEnvironmentVariable"
                },
                "haveJsonPathValue": {
                    "$ref": "#/definitions/DictatableConfigActionExpression"
                },
                "haveLineContaining": {
                    "description": "can be regular expression.",
                    "items": {
                        "minimum": 1,
                        "type": "string"
                    },
                    "type": "string"
                },
                "itShould": {
                    "$ref": "#/definitions/DictatableConfigTriggerItShould",
                    "description": "A path that should EXIST or NOT_EXIST.",
                    "type": "string"
                },
                "not": {
                    "description": "Negate the following triggers.",
                    "items": {
                        "$ref": "#/definitions/DictatableConfigTrigger"
                    },
                    "type": "array"
                },
                "or": {
                    "description": "Or any of these triggers.",
                    "items": {
                        "$ref": "#/definitions/DictatableConfigTrigger"
                    },
                    "type": "array"
                },
                "runningOnPlatform": {
                    "$ref": "#/definitions/PLATFORM_TYPE",
                    "description": "Trigger when running on platform. process.platform. https://nodejs.org/api/process.html#process_process_platform",
                    "items": {
                        "minimum": 1,
                        "type": "string"
                    }
                },
                "target": {
                    "description": "The file to trigger on.",
                    "type": "string"
                }
            },
            "type": "object"
        },
        "DictatableConfigTriggerItShould": {
            "enum": [
                "EXIST",
                "NOT_EXIST"
            ],
            "type": "string"
        },
        "PLATFORM_TYPE": {
            "enum": [
                "aix",
                "darwin",
                "freebsd",
                "linux",
                "openbsd",
                "sunos",
                "win32"
            ],
            "type": "string"
        }
    }
}

