{
    "$schema": "http://json-schema.org/draft-06/schema#",
    "$id": "https://scikit-hep.org/pyhf/schemas/1.0.0/workspace.json",
    "type": "object",
    "properties": {
        "channels": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string"
                    },
                    "samples": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "name": {
                                    "type": "string"
                                },
                                "data": {
                                    "type": "array",
                                    "items": {
                                        "type": "number"
                                    },
                                    "minItems": 1
                                },
                                "modifiers": {
                                    "type": "array",
                                    "items": {
                                        "anyOf": [
                                            {
                                                "type": "object",
                                                "properties": {
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "type": {
                                                        "const": "histosys"
                                                    },
                                                    "data": {
                                                        "type": "object",
                                                        "properties": {
                                                            "lo_data": {
                                                                "type": "array",
                                                                "items": {
                                                                    "type": "number"
                                                                },
                                                                "minItems": 1
                                                            },
                                                            "hi_data": {
                                                                "type": "array",
                                                                "items": {
                                                                    "type": "number"
                                                                },
                                                                "minItems": 1
                                                            }
                                                        },
                                                        "required": [
                                                            "lo_data",
                                                            "hi_data"
                                                        ]
                                                    }
                                                },
                                                "required": [
                                                    "name",
                                                    "type",
                                                    "data"
                                                ],
                                                "additionalProperties": false
                                            },
                                            {
                                                "type": "object",
                                                "properties": {
                                                    "name": {
                                                        "const": "lumi"
                                                    },
                                                    "type": {
                                                        "const": "lumi"
                                                    },
                                                    "data": {
                                                        "type": "null"
                                                    }
                                                },
                                                "required": [
                                                    "name",
                                                    "type",
                                                    "data"
                                                ],
                                                "additionalProperties": false
                                            },
                                            {
                                                "type": "object",
                                                "properties": {
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "type": {
                                                        "const": "normfactor"
                                                    },
                                                    "data": {
                                                        "type": "null"
                                                    }
                                                },
                                                "required": [
                                                    "name",
                                                    "type",
                                                    "data"
                                                ],
                                                "additionalProperties": false
                                            },
                                            {
                                                "type": "object",
                                                "properties": {
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "type": {
                                                        "const": "normsys"
                                                    },
                                                    "data": {
                                                        "type": "object",
                                                        "properties": {
                                                            "lo": {
                                                                "type": "number"
                                                            },
                                                            "hi": {
                                                                "type": "number"
                                                            }
                                                        },
                                                        "required": [
                                                            "lo",
                                                            "hi"
                                                        ]
                                                    }
                                                },
                                                "required": [
                                                    "name",
                                                    "type",
                                                    "data"
                                                ],
                                                "additionalProperties": false
                                            },
                                            {
                                                "type": "object",
                                                "properties": {
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "type": {
                                                        "const": "shapefactor"
                                                    },
                                                    "data": {
                                                        "type": "null"
                                                    }
                                                },
                                                "required": [
                                                    "name",
                                                    "type",
                                                    "data"
                                                ],
                                                "additionalProperties": false
                                            },
                                            {
                                                "type": "object",
                                                "properties": {
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "type": {
                                                        "const": "shapesys"
                                                    },
                                                    "data": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "number"
                                                        },
                                                        "minItems": 1
                                                    }
                                                },
                                                "required": [
                                                    "name",
                                                    "type",
                                                    "data"
                                                ],
                                                "additionalProperties": false
                                            },
                                            {
                                                "type": "object",
                                                "properties": {
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "type": {
                                                        "const": "staterror"
                                                    },
                                                    "data": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "number"
                                                        },
                                                        "minItems": 1
                                                    }
                                                },
                                                "required": [
                                                    "name",
                                                    "type",
                                                    "data"
                                                ],
                                                "additionalProperties": false
                                            }
                                        ]
                                    }
                                }
                            },
                            "required": [
                                "name",
                                "data",
                                "modifiers"
                            ],
                            "additionalProperties": false
                        },
                        "minItems": 1
                    }
                },
                "required": [
                    "name",
                    "samples"
                ],
                "additionalProperties": false
            },
            "minItems": 1
        },
        "measurements": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string"
                    },
                    "config": {
                        "type": "object",
                        "properties": {
                            "poi": {
                                "type": "string"
                            },
                            "parameters": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "properties": {
                                        "name": {
                                            "type": "string"
                                        },
                                        "inits": {
                                            "type": "array",
                                            "items": {
                                                "type": "number"
                                            },
                                            "minItems": 1
                                        },
                                        "bounds": {
                                            "type": "array",
                                            "items": {
                                                "type": "array",
                                                "items": {
                                                    "type": "number",
                                                    "minItems": 2,
                                                    "maxItems": 2
                                                }
                                            },
                                            "minItems": 1
                                        },
                                        "auxdata": {
                                            "type": "array",
                                            "items": {
                                                "type": "number"
                                            },
                                            "minItems": 1
                                        },
                                        "factors": {
                                            "type": "array",
                                            "items": {
                                                "type": "number"
                                            },
                                            "minItems": 1
                                        },
                                        "sigmas": {
                                            "type": "array",
                                            "items": {
                                                "type": "number"
                                            },
                                            "minItems": 1
                                        },
                                        "fixed": {
                                            "type": "boolean"
                                        }
                                    },
                                    "required": [
                                        "name"
                                    ],
                                    "additionalProperties": false
                                }
                            }
                        },
                        "required": [
                            "poi",
                            "parameters"
                        ],
                        "additionalProperties": false
                    }
                },
                "required": [
                    "name",
                    "config"
                ],
                "additionalProperties": false
            },
            "minItems": 1
        },
        "observations": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string"
                    },
                    "data": {
                        "type": "array",
                        "items": {
                            "type": "number"
                        },
                        "minItems": 1
                    }
                },
                "required": [
                    "name",
                    "data"
                ],
                "additionalProperties": false
            },
            "minItems": 1
        },
        "version": {
            "const": "1.0.0"
        }
    },
    "additionalProperties": false,
    "required": [
        "channels",
        "measurements",
        "observations",
        "version"
    ]
}