{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "required": [
        "projects",
        "drivers"
    ],
    "properties": {
        "projects": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "pattern": "^[a-z\\d\\./-]+$"
                    },
                    "name": {
                        "type": "string"
                    }
                },
                "required": [
                    "id",
                    "name"
                ],
                "additionalProperties": false
            }
        },
        "drivers": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "project_id": {
                        "type": "string"
                    },
                    "vendor": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "description": {
                        "type": "string"
                    },
                    "maintainer": {
                        "$ref": "#/definitions/user"
                    },
                    "wiki": {
                        "type": "string"
                    },
                    "os_versions": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "oneOf": [
                                {
                                    "$ref": "#/definitions/self_verification"
                                },
                                {
                                    "$ref": "#/definitions/3rd_party_verification"
                                },
                                {
                                    "$ref": "#/definitions/external_ci_verification"
                                }
                            ]
                        }
                    }
                },
                "required": [
                    "project_id",
                    "vendor",
                    "name",
                    "os_versions",
                    "maintainer"
                ],
                "additionalProperties": false
            }
        }
    },
    "definitions": {
        "user": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string"
                },
                "email": {
                    "type": "string",
                    "pattern": "^[a-z\\d_\\.-]+@([a-z\\d\\.-]+\\.)+[a-z]+$"
                },
                "irc": {
                    "type": "string"
                },
                "launchpad_id": {
                    "type": "string"
                }
            },
            "required": [
                "name"
            ],
            "additionalProperties": false
        },
        "self_verification": {
            "properties": {
                "verification": {
                    "enum": [
                        "self_verification"
                    ]
                },
                "os_version": {
                    "type": "string"
                },
                "success": {
                    "type": "boolean"
                }
            },
            "required": [
                "verification",
                "os_version",
                "success"
            ],
            "additionalProperties": false
        },
        "3rd_party_verification": {
            "properties": {
                "verification": {
                    "enum": [
                        "3rd_party_verification"
                    ]
                },
                "os_version": {
                    "type": "string"
                },
                "success": {
                    "type": "boolean"
                },
                "verifiers": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/user"
                    }
                }
            },
            "required": [
                "verification",
                "os_version",
                "success",
                "verifiers"
            ],
            "additionalProperties": false
        },
        "external_ci_verification": {
            "properties": {
                "verification": {
                    "enum": [
                        "external_ci_verification"
                    ]
                },
                "ci_id": {
                    "type": "string"
                }
            },
            "required": [
                "verification",
                "ci_id"
            ],
            "additionalProperties": false
        }
    }
}