{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "required": [
        "users",
        "releases",
        "companies",
        "repos",
        "project_types"
    ],
    "properties": {
        "users": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "launchpad_id": {
                        "type": "string",
                        "pattern": "^[a-z\\d\\.\\+-]+$"
                    },
                    "github_id": {
                        "type": "string"
                    },
                    "gerrit_id": {
                        "type": "string"
                    },
                    "ldap_id": {
                        "type": "string"
                    },
                    "zanata_id": {
                        "type": "string"
                    },
                    "user_name": {
                        "type": "string"
                    },
                    "emails": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "pattern": "^[a-z\\d_\\.\\+-]+@([a-z\\d\\.-]+\\.)*(([a-z]+)|\\(none\\))$"
                        },
                        "minItems": 1
                    },
                    "companies": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "company_name": {
                                    "type": "string"
                                },
                                "end_date": {
                                    "$ref": "#/definitions/date_format"
                                }
                            },
                            "required": [
                                "company_name",
                                "end_date"
                            ],
                            "additionalProperties": false
                        },
                        "minItems": 1
                    }
                },
                "required": [
                    "user_name",
                    "emails"
                ],
                "additionalProperties": false
            }
        },
        "releases": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "release_name": {
                        "type": "string"
                    },
                    "end_date": {
                        "$ref": "#/definitions/date_format"
                    },
                    "refs": {
                        "type": "object"
                    }
                },
                "required": [
                    "release_name",
                    "end_date"
                ],
                "additionalProperties": false
            }
        },
        "repos": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "uri": {
                        "type": "string"
                    },
                    "organization": {
                        "type": "string"
                    },
                    "module": {
                        "type": "string"
                    },
                    "releases": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "branch": {
                                    "type": "string"
                                },
                                "tag_from": {
                                    "type": "string"
                                },
                                "tag_to": {
                                    "type": "string"
                                },
                                "release_name": {
                                    "type": "string"
                                }
                            },
                            "required": [
                                "tag_from",
                                "tag_to",
                                "release_name"
                            ]
                        }
                    },
                    "aliases": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "default_branch": {
                        "type": "string"
                    }
                },
                "required": [
                    "uri",
                    "module",
                    "organization"
                ],
                "additionalProperties": false
            }
        },
        "companies": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "company_name": {
                        "type": "string"
                    },
                    "domains": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "pattern": "^[a-z\\d\\.-]*$"
                        }
                    },
                    "aliases": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    }
                },
                "required": [
                    "company_name",
                    "domains"
                ],
                "additionalProperties": false
            }
        },
        "project_sources": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "organization": {
                        "type": "string"
                    },
                    "uri": {
                        "type": "string"
                    },
                    "git_base_uri": {
                        "type": "string"
                    },
                    "ssh_key_filename": {
                        "type": "string"
                    },
                    "ssh_username": {
                        "type": "string"
                    },
                    "exclude": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "default_branch": {
                        "type": "string"
                    },
                    "module_group_id": {
                        "type": "string"
                    }
                },
                "required": [
                    "organization"
                ],
                "additionalProperties": false
            }
        },
        "module_groups": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "module_group_name": {
                        "type": "string",
                        "pattern": "^[\\w-]+$"
                    },
                    "modules": {
                        "type": [
                            "array"
                        ],
                        "items": {
                            "type": "string"
                        }
                    }
                },
                "required": [
                    "module_group_name",
                    "modules"
                ],
                "additionalProperties": false
            }
        },
        "mail_lists": {
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "member_lists": {
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "project_types": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "pattern": "^[\\w:-]+$"
                    },
                    "child": {
                        "type": "boolean"
                    },
                    "title": {
                        "type": "string"
                    },
                    "modules": {
                        "type": [
                            "array"
                        ],
                        "items": {
                            "type": "string",
                            "pattern": "^[\\w:-]+$"
                        }
                    }
                },
                "required": [
                    "id",
                    "title",
                    "modules"
                ],
                "additionalProperties": false
            }
        }
    },
    "definitions": {
        "date_format": {
            "type": [
                "string",
                "null"
            ],
            "pattern": "^20\\d{2}-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-[0-3]\\d$"
        }
    }
}