{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "$id": "https://raw.githubusercontent.com/OpenLightingProject/open-fixture-library/master/schemas/definitions.json",
    "$comment": "This file is used by another schema file and should not be used directly as a JSON schema.",
    "nonEmptyString": {
        "type": "string",
        "pattern": "^[^\n]+$"
    },
    "noVariablesString": {
        "type": "string",
        "pattern": "^[^$\n]+$"
    },
    "variablePixelKeyString": {
        "type": "string",
        "pattern": "\\$pixelKey"
    },
    "nonEmptyMultilineString": {
        "type": "string",
        "minLength": 1
    },
    "modeNameString": {
        "allOf": [
            {
                "$ref": "#/nonEmptyString"
            },
            {
                "pattern": "^((?!mode)(?!Mode).)*$"
            }
        ]
    },
    "urlString": {
        "type": "string",
        "pattern": "^(ftp|http|https)://[^ \"]+$",
        "format": "uri"
    },
    "urlArray": {
        "type": "array",
        "minItems": 1,
        "_uniqueItems": true,
        "items": {
            "$ref": "#/urlString"
        }
    },
    "isoDateString": {
        "type": "string",
        "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
        "format": "date"
    },
    "colorString": {
        "type": "string",
        "pattern": "^#[0-9a-f]{6}$",
        "format": "color-hex"
    },
    "dimensionsXYZ": {
        "$comment": "width, height, depth (in mm)",
        "type": "array",
        "minItems": 3,
        "maxItems": 3,
        "items": {
            "type": "number",
            "minimum": 0
        }
    },
    "effectPreset": {
        "enum": [
            "ColorJump",
            "ColorFade"
        ]
    },
    "goboResourceString": {
        "type": "string",
        "oneOf": [
            {
                "pattern": "^gobos/[a-z0-9-]+$"
            },
            {
                "pattern": "^gobos/aliases/[a-z0-9_.-]+/"
            }
        ]
    },
    "units": {
        "number": {
            "type": "number"
        },
        "nonNegativeNumber": {
            "type": "number",
            "minimum": 0
        },
        "positiveInteger": {
            "type": "integer",
            "minimum": 0,
            "exclusiveMinimum": 0
        },
        "dmxValue": {
            "type": "integer",
            "minimum": 0,
            "$comment": "maximum depends on how many fine channels there are (255 if none, 65535 if one, etc.)"
        },
        "dmxValuePercent": {
            "type": "string",
            "pattern": "^(([1-9][0-9]?|0)(\\.[0-9]+)?|100)%$"
        },
        "percent": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?%$"
        },
        "hertz": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?Hz$"
        },
        "beatsPerMinute": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?bpm$"
        },
        "roundsPerMinute": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?rpm$"
        },
        "seconds": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?s$"
        },
        "milliSeconds": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?ms$"
        },
        "meters": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?m$"
        },
        "lumens": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?lm$"
        },
        "kelvin": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?K$"
        },
        "volumePerMinute": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?m\\^3/min$"
        },
        "degrees": {
            "type": "string",
            "pattern": "^-?[0-9]+(\\.[0-9]+)?deg$"
        }
    },
    "entities": {
        "speed": {
            "oneOf": [
                {
                    "$ref": "#/units/hertz"
                },
                {
                    "$ref": "#/units/beatsPerMinute"
                },
                {
                    "$ref": "#/units/percent"
                },
                {
                    "enum": [
                        "fast",
                        "slow",
                        "stop",
                        "slow reverse",
                        "fast reverse"
                    ]
                }
            ]
        },
        "rotationSpeed": {
            "oneOf": [
                {
                    "$ref": "#/units/hertz"
                },
                {
                    "$ref": "#/units/roundsPerMinute"
                },
                {
                    "$ref": "#/units/percent"
                },
                {
                    "enum": [
                        "fast CW",
                        "slow CW",
                        "stop",
                        "slow CCW",
                        "fast CCW"
                    ]
                }
            ]
        },
        "time": {
            "oneOf": [
                {
                    "$ref": "#/units/seconds"
                },
                {
                    "$ref": "#/units/milliSeconds"
                },
                {
                    "$ref": "#/units/percent"
                },
                {
                    "enum": [
                        "instant",
                        "short",
                        "long"
                    ]
                }
            ]
        },
        "distance": {
            "oneOf": [
                {
                    "$ref": "#/units/meters"
                },
                {
                    "$ref": "#/units/percent"
                },
                {
                    "enum": [
                        "near",
                        "far"
                    ]
                }
            ]
        },
        "brightness": {
            "oneOf": [
                {
                    "$ref": "#/units/lumens"
                },
                {
                    "$ref": "#/units/percent"
                },
                {
                    "enum": [
                        "off",
                        "dark",
                        "bright"
                    ]
                }
            ]
        },
        "colorTemperature": {
            "oneOf": [
                {
                    "$ref": "#/units/kelvin"
                },
                {
                    "$ref": "#/units/percent"
                },
                {
                    "enum": [
                        "warm",
                        "CTO",
                        "default",
                        "cold",
                        "CTB"
                    ]
                }
            ]
        },
        "fogOutput": {
            "oneOf": [
                {
                    "$ref": "#/units/volumePerMinute"
                },
                {
                    "$ref": "#/units/percent"
                },
                {
                    "enum": [
                        "off",
                        "weak",
                        "strong"
                    ]
                }
            ]
        },
        "rotationAngle": {
            "oneOf": [
                {
                    "$ref": "#/units/degrees"
                },
                {
                    "$ref": "#/units/percent"
                }
            ]
        },
        "beamAngle": {
            "oneOf": [
                {
                    "$ref": "#/units/degrees"
                },
                {
                    "$ref": "#/units/percent"
                },
                {
                    "enum": [
                        "closed",
                        "narrow",
                        "wide"
                    ]
                }
            ]
        },
        "horizontalAngle": {
            "oneOf": [
                {
                    "$ref": "#/units/degrees"
                },
                {
                    "$ref": "#/units/percent"
                },
                {
                    "enum": [
                        "left",
                        "center",
                        "right"
                    ]
                }
            ]
        },
        "verticalAngle": {
            "oneOf": [
                {
                    "$ref": "#/units/degrees"
                },
                {
                    "$ref": "#/units/percent"
                },
                {
                    "enum": [
                        "top",
                        "center",
                        "bottom"
                    ]
                }
            ]
        },
        "swingAngle": {
            "oneOf": [
                {
                    "$ref": "#/units/degrees"
                },
                {
                    "$ref": "#/units/percent"
                },
                {
                    "enum": [
                        "closed",
                        "narrow",
                        "wide"
                    ]
                }
            ]
        },
        "parameter": {
            "oneOf": [
                {
                    "$ref": "#/units/number"
                },
                {
                    "$ref": "#/units/percent"
                },
                {
                    "enum": [
                        "off",
                        "low",
                        "high",
                        "slow",
                        "fast",
                        "small",
                        "big",
                        "instant",
                        "short",
                        "long"
                    ]
                }
            ]
        },
        "slotNumber": {
            "$ref": "#/units/nonNegativeNumber"
        },
        "percent": {
            "oneOf": [
                {
                    "$ref": "#/units/percent"
                },
                {
                    "enum": [
                        "off",
                        "low",
                        "high"
                    ]
                }
            ]
        },
        "insertion": {
            "oneOf": [
                {
                    "$ref": "#/units/percent"
                },
                {
                    "enum": [
                        "out",
                        "in"
                    ]
                }
            ]
        },
        "irisPercent": {
            "oneOf": [
                {
                    "$ref": "#/units/percent"
                },
                {
                    "enum": [
                        "closed",
                        "open"
                    ]
                }
            ]
        }
    },
    "properties": {
        "nonEmptyString": {
            "$ref": "#/nonEmptyString"
        },
        "noVariablesString": {
            "$ref": "#/noVariablesString"
        },
        "variablePixelKeyString": {
            "$ref": "#/variablePixelKeyString"
        },
        "nonEmptyMultilineString": {
            "$ref": "#/nonEmptyMultilineString"
        },
        "modeNameString": {
            "$ref": "#/modeNameString"
        },
        "urlString": {
            "$ref": "#/urlString"
        },
        "urlArray": {
            "$ref": "#/urlArray"
        },
        "isoDateString": {
            "$ref": "#/isoDateString"
        },
        "colorString": {
            "$ref": "#/colorString"
        },
        "dimensionsXYZ": {
            "$ref": "#/dimensionsXYZ"
        },
        "effectPreset": {
            "$ref": "#/effectPreset"
        },
        "goboResourceString": {
            "$ref": "#/goboResourceString"
        },
        "units.number": {
            "$ref": "#/units/number"
        },
        "units.nonNegativeNumber": {
            "$ref": "#/units/nonNegativeNumber"
        },
        "units.positiveInteger": {
            "$ref": "#/units/positiveInteger"
        },
        "units.dmxValue": {
            "$ref": "#/units/dmxValue"
        },
        "units.dmxValuePercent": {
            "$ref": "#/units/dmxValuePercent"
        },
        "units.percent": {
            "$ref": "#/units/percent"
        },
        "units.hertz": {
            "$ref": "#/units/hertz"
        },
        "units.beatsPerMinute": {
            "$ref": "#/units/beatsPerMinute"
        },
        "units.roundsPerMinute": {
            "$ref": "#/units/roundsPerMinute"
        },
        "units.seconds": {
            "$ref": "#/units/seconds"
        },
        "units.milliSeconds": {
            "$ref": "#/units/milliSeconds"
        },
        "units.meters": {
            "$ref": "#/units/meters"
        },
        "units.lumens": {
            "$ref": "#/units/lumens"
        },
        "units.kelvin": {
            "$ref": "#/units/kelvin"
        },
        "units.volumePerMinute": {
            "$ref": "#/units/volumePerMinute"
        },
        "units.degrees": {
            "$ref": "#/units/degrees"
        },
        "entities.speed": {
            "$ref": "#/entities/speed"
        },
        "entities.rotationSpeed": {
            "$ref": "#/entities/rotationSpeed"
        },
        "entities.time": {
            "$ref": "#/entities/time"
        },
        "entities.distance": {
            "$ref": "#/entities/distance"
        },
        "entities.brightness": {
            "$ref": "#/entities/brightness"
        },
        "entities.colorTemperature": {
            "$ref": "#/entities/colorTemperature"
        },
        "entities.fogOutput": {
            "$ref": "#/entities/fogOutput"
        },
        "entities.rotationAngle": {
            "$ref": "#/entities/rotationAngle"
        },
        "entities.beamAngle": {
            "$ref": "#/entities/beamAngle"
        },
        "entities.horizontalAngle": {
            "$ref": "#/entities/horizontalAngle"
        },
        "entities.verticalAngle": {
            "$ref": "#/entities/verticalAngle"
        },
        "entities.swingAngle": {
            "$ref": "#/entities/swingAngle"
        },
        "entities.parameter": {
            "$ref": "#/entities/parameter"
        },
        "entities.slotNumber": {
            "$ref": "#/entities/slotNumber"
        },
        "entities.percent": {
            "$ref": "#/entities/percent"
        },
        "entities.insertion": {
            "$ref": "#/entities/insertion"
        },
        "entities.irisPercent": {
            "$ref": "#/entities/irisPercent"
        }
    },
    "required": [
        "nonEmptyString",
        "noVariablesString",
        "variablePixelKeyString",
        "nonEmptyMultilineString",
        "modeNameString",
        "urlString",
        "urlArray",
        "isoDateString",
        "colorString",
        "dimensionsXYZ",
        "effectPreset",
        "goboResourceString",
        "units.number",
        "units.nonNegativeNumber",
        "units.positiveInteger",
        "units.dmxValue",
        "units.dmxValuePercent",
        "units.percent",
        "units.hertz",
        "units.beatsPerMinute",
        "units.roundsPerMinute",
        "units.seconds",
        "units.milliSeconds",
        "units.meters",
        "units.lumens",
        "units.kelvin",
        "units.volumePerMinute",
        "units.degrees",
        "entities.speed",
        "entities.rotationSpeed",
        "entities.time",
        "entities.distance",
        "entities.brightness",
        "entities.colorTemperature",
        "entities.fogOutput",
        "entities.rotationAngle",
        "entities.beamAngle",
        "entities.horizontalAngle",
        "entities.verticalAngle",
        "entities.swingAngle",
        "entities.parameter",
        "entities.slotNumber",
        "entities.percent",
        "entities.insertion",
        "entities.irisPercent"
    ]
}