{
    "$schema": "http://json-schema.org/draft-06/schema#",
    "$id": "https://results.lavote.net/electionresults/json",
    "$title": "LA County Election Results Schema",
    "$ref": "#/definitions/Data",
    "definitions": {
        "Data": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "Election": {
                    "$ref": "#/definitions/Election"
                },
                "Timestamp": {
                    "type": "string",
                    "format": "date-time"
                }
            },
            "required": [
                "Election",
                "Timestamp"
            ],
            "title": "Data"
        },
        "Election": {
            "type": "object",
            "description": "contains general information about the election",
            "additionalProperties": false,
            "properties": {
                "ID": {
                    "type": "integer",
                    "description": "the election id"
                },
                "Date": {
                    "type": "string",
                    "description": "the election date",
                    "format": "date-time"
                },
                "Title": {
                    "type": "string",
                    "description": "the election title"
                },
                "ContestGroups": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/ContestGroup",
                        "description": "listing of contest groups for this election"
                    }
                }
            },
            "required": [
                "ContestGroups",
                "Date",
                "ID",
                "Title"
            ],
            "title": "Election"
        },
        "ContestGroup": {
            "type": "object",
            "description": "a grouping of contest(s) for an election",
            "additionalProperties": false,
            "properties": {
                "Name": {
                    "type": "string",
                    "description": "the contest group name"
                },
                "Contests": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/Contest",
                        "description": "listing of contests for this contest group"
                    }
                }
            },
            "required": [
                "Contests",
                "Name"
            ],
            "title": "ContestGroup"
        },
        "Contest": {
            "type": "object",
            "description": "contains information related to a specific contest",
            "additionalProperties": false,
            "properties": {
                "Title": {
                    "type": "string",
                    "description": "the contest title"
                },
                "Type": {
                    "$ref": "#/definitions/Type",
                    "description": "the contests type (i.e. candidate vs measure)"
                },
                "AdditionalText": {
                    "type": "string",
                    "description": "additional text related to the contest"
                },
                "MeasureText": {
                    "type": "string",
                    "description": "any measure related text for the contest"
                },
                "MeasurePassRate": {
                    "$ref": "#/definitions/MeasurePassRate",
                    "description": "indicates the votes cast requirement for the measure to pass"
                },
                "VoteFor": {
                    "$ref": "#/definitions/VoteFor",
                    "description": "indicates the votes for requirement for the contest (i.e. Vote for no more than two)"
                },
                "Candidates": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/Candidate",
                        "description": "listing of candidates for this contest"
                    }
                }
            },
            "required": [
                "AdditionalText",
                "Candidates",
                "MeasurePassRate",
                "MeasureText",
                "Title",
                "Type",
                "VoteFor"
            ],
            "title": "Contest"
        },
        "Candidate": {
            "type": "object",
            "description": "contains information related to a specific candidate",
            "additionalProperties": false,
            "properties": {
                "Name": {
                    "type": "string",
                    "description": "name of the candidate"
                },
                "Party": {
                    "$ref": "#/definitions/Party",
                    "description": "party of the candidate"
                },
                "Votes": {
                    "type": "integer",
                    "description": "votes cast for the candidate"
                }
            },
            "required": [
                "Name",
                "Party",
                "Votes"
            ],
            "title": "Candidate"
        },
        "Party": {
            "type": "string",
            "description": "parties referenced for this election",
            "enum": [
                "Non Partisan",
                "Democratic",
                "Republican",
                "Green",
                "Peace and Freedom",
                "Libertarian",
                "American Independent"
            ],
            "title": "Party"
        },
        "MeasurePassRate": {
            "type": "string",
            "description": "measure pass rates referenced for this election",
            "enum": [
                "",
                "Majority of votes cast",
                "2/3 of votes cast",
                "55% of votes cast"
            ],
            "title": "MeasurePassRate"
        },
        "Type": {
            "type": "string",
            "description": "contests and election types referenced for this election",
            "enum": [
                "Candidate",
                "Measure",
                "Presidential"
            ],
            "title": "Type"
        },
        "VoteFor": {
            "type": "string",
            "description": "vote for types referenced for this election",
            "enum": [
                "",
                "Vote for no more than two",
                "Vote for no more than three",
                "Vote for no more than four"
            ],
            "title": "VoteFor"
        }
    }
}