{
    "$schema": "http://json-schema.org/draft-04/schema",
    "description": "Contains all details necessary for NMOS Controller Testing",
    "properties": {
        "answer_uri": {
            "description": "URL of the test suite API endpoint to send the POST request with answers",
            "format": "uri",
            "type": "string"
        },
        "answers": {
            "oneOf": [
                {
                    "description": "Action type questions",
                    "type": "null"
                },
                {
                    "description": "Array containing answer objects to be used to select the correct answer_id to be returned",
                    "examples": [
                        [
                            {
                                "answer_id": "answer_2",
                                "display_answer": "s3/wright (Mock sender 3, 71ce775c-cdc5-479a-bd29-87c081905ecf)",
                                "resource": {
                                    "description": "Mock sender 3",
                                    "id": "71ce775c-cdc5-479a-bd29-87c081905ecf",
                                    "label": "s3/wright"
                                }
                            }
                        ]
                    ],
                    "items": {
                        "description": "Individual answer details, the label, description and id of the relevant resource and an associated answer_id",
                        "properties": {
                            "answer_id": {
                                "description": "ID unique to each answer within a question. This is the value to be returned for validation",
                                "pattern": "^answer_[0-9]+$",
                                "type": "string"
                            },
                            "display_answer": {
                                "description": "String combining all the resource details for display on the testing facade",
                                "type": "string"
                            },
                            "resource": {
                                "$schema": "http://json-schema.org/draft-04/schema",
                                "description": "Resource details for senders and receivers used in IS05 Connection Management tests",
                                "properties": {
                                    "description": {
                                        "description": "Description of resource as might be shown on NCuT",
                                        "type": "string"
                                    },
                                    "id": {
                                        "description": "ID of resource as might be shown on NCuT",
                                        "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
                                        "type": "string"
                                    },
                                    "label": {
                                        "description": "Label of resource as might be shown on NCuT",
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "id",
                                    "label",
                                    "description"
                                ],
                                "title": "Controller Testing - Resource Details",
                                "type": "object"
                            }
                        },
                        "required": [
                            "answer_id",
                            "display_answer",
                            "resource"
                        ],
                        "type": "object"
                    },
                    "type": "array"
                }
            ]
        },
        "description": {
            "description": "A brief description of the test",
            "type": "string"
        },
        "metadata": {
            "anyOf": [
                {
                    "type": "null"
                },
                {
                    "additionalProperties": false,
                    "minProperties": 1,
                    "properties": {
                        "receiver": {
                            "$schema": "http://json-schema.org/draft-04/schema",
                            "description": "Resource details for senders and receivers used in IS05 Connection Management tests",
                            "properties": {
                                "description": {
                                    "description": "Description of resource as might be shown on NCuT",
                                    "type": "string"
                                },
                                "id": {
                                    "description": "ID of resource as might be shown on NCuT",
                                    "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
                                    "type": "string"
                                },
                                "label": {
                                    "description": "Label of resource as might be shown on NCuT",
                                    "type": "string"
                                }
                            },
                            "required": [
                                "id",
                                "label",
                                "description"
                            ],
                            "title": "Controller Testing - Resource Details",
                            "type": "object"
                        },
                        "sender": {
                            "$schema": "http://json-schema.org/draft-04/schema",
                            "description": "Resource details for senders and receivers used in IS05 Connection Management tests",
                            "properties": {
                                "description": {
                                    "description": "Description of resource as might be shown on NCuT",
                                    "type": "string"
                                },
                                "id": {
                                    "description": "ID of resource as might be shown on NCuT",
                                    "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
                                    "type": "string"
                                },
                                "label": {
                                    "description": "Label of resource as might be shown on NCuT",
                                    "type": "string"
                                }
                            },
                            "required": [
                                "id",
                                "label",
                                "description"
                            ],
                            "title": "Controller Testing - Resource Details",
                            "type": "object"
                        },
                        "test_class": {
                            "description": "Python class name of the NMOS Testing controller suite, used to select automated test instructions",
                            "type": "string"
                        }
                    },
                    "type": "object"
                }
            ],
            "default": null,
            "description": "Extra information to assist fully automated testing"
        },
        "name": {
            "description": "The test name, indicating the test that sent the question",
            "pattern": "^test_[0-9a-z_]+$",
            "type": "string"
        },
        "question": {
            "description": "Human readable question text containing instructions to carry out the test",
            "type": "string"
        },
        "question_id": {
            "anyOf": [
                {
                    "description": "Identifier for messages sent at the beginning and end of every set of tests",
                    "enum": [
                        "pre_tests_message",
                        "post_tests_message"
                    ],
                    "type": "string"
                },
                {
                    "description": "Identifier for questions within a test",
                    "pattern": "^test_[0-9a-z_]+$",
                    "type": "string"
                }
            ],
            "description": "A unique string for each individual question sent. Where a test contains multiple questions they will share a name attribute but have a unique id"
        },
        "test_type": {
            "description": "The type of question being sent indicating the type of answer that needs to be returned",
            "enum": [
                "single_choice",
                "multi_choice",
                "action"
            ],
            "type": "string"
        },
        "timeout": {
            "description": "Time in seconds the test suite will wait to receive an answer to a particular question",
            "type": [
                "number",
                "null"
            ]
        }
    },
    "required": [
        "test_type",
        "question_id",
        "name",
        "description",
        "question",
        "answers",
        "timeout",
        "answer_uri",
        "metadata"
    ],
    "title": "Controller Testing - Question",
    "type": "object"
}
