{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "id": "http://www.qiskit.org/schemas/result_schema.json",
    "title": "qobj results",
    "description": "The results of executing a qobj",
    "version": "1.0.0",
    "definitions": {
        "complex": {
            "description": "JSON representation of a complex number",
            "type": "array",
            "minItems": 2,
            "maxItems": 2,
            "items": {
                "type": "number"
            }
        },
        "complex_array": {
            "description": "JSON representation of a complex vector",
            "type": "array",
            "minItems": 1,
            "items": {
                "$ref": "#/definitions/complex"
            }
        },
        "complex_matrix": {
            "description": "JSON representation of a complex matrix",
            "type": "array",
            "minItems": 1,
            "items": {
                "$ref": "#/definitions/complex_array"
            }
        },
        "memory": {
            "type": "array",
            "minItems": 1,
            "description": "Output of the memory"
        },
        "resultobj": {
            "type": "object",
            "required": [
                "success",
                "shots",
                "data"
            ],
            "properties": {
                "shots": {
                    "oneOf": [
                        {
                            "type": "array",
                            "minItems": 2,
                            "maxItems": 2,
                            "items": {
                                "type": "integer",
                                "minimum": 1
                            }
                        },
                        {
                            "type": "integer"
                        }
                    ],
                    "description": "The starting and ending shot for this data. If there is only one shot to the experiment this is [1,1]"
                },
                "success": {
                    "type": "boolean",
                    "description": "If true, we can trust results for this experiment."
                },
                "status": {
                    "type": "string",
                    "description": "Human-readable description of status of this experiment"
                },
                "seed": {
                    "type": "integer",
                    "description": "Experiment-level random seed"
                },
                "meas_level": {
                    "type": "integer",
                    "enum": [
                        0,
                        1,
                        2
                    ],
                    "description": "Measurement level of experiment"
                },
                "meas_return": {
                    "type": "string",
                    "enum": [
                        "single",
                        "avg"
                    ],
                    "description": "Is the data averaged or from each shot"
                },
                "header": {
                    "type": "object",
                    "properties": {},
                    "description": "Header passed through from the qobj with experiment metadata"
                },
                "data": {
                    "type": "object",
                    "properties": {
                        "counts": {
                            "type": "object",
                            "description": "Histogram of the memory over the indicated shots",
                            "patternProperties": {
                                "^0x([0-9A-Fa-f])+$": {
                                    "type": "integer",
                                    "minimum": 0
                                }
                            },
                            "additionalProperties": false
                        },
                        "snapshots": {
                            "description": "collection of all snapshots of simulator state",
                            "type": "object"
                        },
                        "memory": {
                            "$ref": "#/definitions/memory"
                        },
                        "statevector": {
                            "$ref": "#/definitions/complex_array"
                        },
                        "unitary": {
                            "$ref": "#/definitions/complex_matrix"
                        }
                    }
                }
            }
        }
    },
    "type": "object",
    "required": [
        "backend_name",
        "backend_version",
        "qobj_id",
        "job_id",
        "success",
        "results"
    ],
    "properties": {
        "backend_name": {
            "type": "string",
            "description": "Backend name"
        },
        "backend_version": {
            "type": "string",
            "pattern": "[0-9]+.[0-9]+.[0-9]+$",
            "description": "Backend version in the form X.X.X"
        },
        "qobj_id": {
            "type": "string",
            "description": "User generated Qobj id"
        },
        "job_id": {
            "type": "string",
            "description": "Unique execution id from the backend"
        },
        "date": {
            "type": "string",
            "format": "date-time",
            "description": "Date/time of job execution"
        },
        "success": {
            "type": "boolean",
            "description": "True if complete input qobj executed correctly. (Implies each experiment success)"
        },
        "status": {
            "type": "string",
            "description": "Human-readable status of complete qobj execution"
        },
        "header": {
            "type": "object",
            "properties": {},
            "description": "Header passed through from the qobj with job metadata"
        },
        "results": {
            "type": "array",
            "description": "Corresponding results for array of experiments of the input qobj",
            "items": {
                "$ref": "#/definitions/resultobj"
            }
        }
    }
}