{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "definitions": {
        "artifact_metadata": {
            "description": "Metadata about an artifact",
            "properties": {
                "artifact_type": {
                    "description": "Semantic type of an artifact",
                    "anyOf": [
                        {
                            "enum": [
                                "SYSLOG",
                                "STDOUT",
                                "STDERR",
                                "CUSTOM",
                                "RESTRICTED_LOG",
                                "REPORT",
                                "DEBUG"
                            ]
                        },
                        {
                            "type": "string"
                        }
                    ]
                },
                "component_moniker": {
                    "description": "The moniker of the component in the test realm that produced the artifact",
                    "type": "string"
                }
            },
            "required": [
                "artifact_type"
            ]
        },
        "entityCommon": {
            "description": "Fields common to the test run, suite runs, and test cases",
            "properties": {
                "artifacts": {
                    "description": "Artifacts are output data produced by a test. This maps the relative path of an artifact within artifact_dir to metadata associated with the artifact.",
                    "patternProperties": {
                        "": {
                            "$ref": "#/definitions/artifact_metadata"
                        }
                    }
                },
                "artifact_dir": {
                    "description": "Subdirectory containing all artifacts scoped to the test run, suite run, or test case",
                    "type": "string"
                },
                "duration_milliseconds": {
                    "description": "Run duration in milliseconds",
                    "type": "integer"
                },
                "start_time_milliseconds": {
                    "description": "Start time as milliseconds since the UNIX epoch",
                    "type": "integer"
                },
                "outcome": {
                    "description": "The outcome scoped to a suite run or test case",
                    "anyOf": [
                        {
                            "enum": [
                                "NOT_STARTED",
                                "PASSED",
                                "FAILED",
                                "INCONCLUSIVE",
                                "TIMEDOUT",
                                "ERROR",
                                "SKIPPED"
                            ]
                        },
                        {
                            "type": "string"
                        }
                    ]
                }
            },
            "required": [
                "outcome"
            ]
        },
        "caseEntry": {
            "allOf": [
                {
                    "$ref": "#/definitions/entityCommon"
                },
                {
                    "properties": {
                        "name": {
                            "description": "name of the test case",
                            "type": "string"
                        }
                    },
                    "required": [
                        "name"
                    ]
                }
            ]
        },
        "suiteEntry": {
            "description": "Results for a single suite run",
            "allOf": [
                {
                    "$ref": "#/definitions/entityCommon"
                },
                {
                    "properties": {
                        "cases": {
                            "description": "list of test cases",
                            "items": {
                                "$ref": "#/definitions/caseEntry"
                            },
                            "type": "array"
                        },
                        "name": {
                            "description": "name of the test suite",
                            "type": "string"
                        }
                    },
                    "required": [
                        "name",
                        "cases"
                    ]
                }
            ]
        }
    },
    "allOf": [
        {
            "$ref": "../common-00000000.json#/definitions/envelope"
        },
        {
            "properties": {
                "data": {
                    "description": "Results for a test run",
                    "allOf": [
                        {
                            "$ref": "#/definitions/entityCommon"
                        },
                        {
                            "properties": {
                                "suites": {
                                    "description": "List of suite runs under the test run",
                                    "items": {
                                        "$ref": "#/definitions/suiteEntry"
                                    },
                                    "type": "array"
                                }
                            },
                            "required": [
                                "suites"
                            ],
                            "type": "object"
                        }
                    ]
                }
            },
            "type": "object"
        }
    ],
    "description": "Format for the run summary of a Fuchsia test output directory",
    "id": "https://fuchsia.dev/schema/ffx_test/run_summary-8d1dd964.json",
    "type": "object"
}
