{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "required": [
        "base_path",
        "details",
        "document_type",
        "publishing_app",
        "rendering_app",
        "routes",
        "schema_name",
        "title"
    ],
    "additionalProperties": false,
    "properties": {
        "access_limited": {
            "$ref": "#/definitions/access_limited"
        },
        "analytics_identifier": {
            "$ref": "#/definitions/analytics_identifier"
        },
        "auth_bypass_ids": {
            "description": "A list of ids that will allow access to this item for non-authenticated users",
            "$ref": "#/definitions/guid_list"
        },
        "base_path": {
            "$ref": "#/definitions/absolute_path"
        },
        "bulk_publishing": {
            "type": "boolean"
        },
        "change_note": {
            "type": [
                "null",
                "string"
            ]
        },
        "description": {
            "$ref": "#/definitions/description_optional"
        },
        "details": {
            "$ref": "#/definitions/details"
        },
        "document_type": {
            "type": "string",
            "enum": [
                "guidance",
                "form",
                "foi_release",
                "promotional",
                "notice",
                "correspondence",
                "research",
                "official_statistics",
                "transparency",
                "statutory_guidance",
                "independent_report",
                "national_statistics",
                "corporate_report",
                "policy_paper",
                "decision",
                "map",
                "regulation",
                "international_treaty",
                "impact_assessment",
                "imported"
            ]
        },
        "first_published_at": {
            "$ref": "#/definitions/first_published_at"
        },
        "last_edited_at": {
            "description": "Last time when the content received a major or minor update.",
            "type": "string",
            "format": "date-time"
        },
        "links": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "government": {
                    "description": "The government associated with this document",
                    "$ref": "#/definitions/guid_list",
                    "maxItems": 1
                },
                "organisations": {
                    "$ref": "#/definitions/guid_list"
                },
                "original_primary_publishing_organisation": {
                    "description": "The organisation that published the original version of the page. Corresponds to the first of the 'Lead organisations' in Whitehall for the first edition, and is empty for all other publishing applications.",
                    "$ref": "#/definitions/guid_list"
                },
                "parent": {
                    "$ref": "#/definitions/guid_list"
                },
                "people": {
                    "description": "People that are associated with this document, typically the person part of a role association",
                    "$ref": "#/definitions/guid_list"
                },
                "policy_areas": {
                    "description": "A largely deprecated tag currently only used to power email alerts.",
                    "$ref": "#/definitions/guid_list"
                },
                "primary_publishing_organisation": {
                    "description": "The organisation that published the page. Corresponds to the first of the 'Lead organisations' in Whitehall, and is empty for all other publishing applications.",
                    "$ref": "#/definitions/guid_list",
                    "maxItems": 1
                },
                "related_policies": {
                    "$ref": "#/definitions/guid_list"
                },
                "related_statistical_data_sets": {
                    "$ref": "#/definitions/guid_list"
                },
                "roles": {
                    "description": "Government roles that are associated with this document, typically the role part of a role association",
                    "$ref": "#/definitions/guid_list"
                },
                "topical_events": {
                    "$ref": "#/definitions/guid_list"
                },
                "topics": {
                    "$ref": "#/definitions/guid_list"
                },
                "world_locations": {
                    "$ref": "#/definitions/guid_list"
                }
            }
        },
        "locale": {
            "$ref": "#/definitions/locale"
        },
        "need_ids": {
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "phase": {
            "description": "The service design phase of this content item - https://www.gov.uk/service-manual/phases",
            "type": "string",
            "enum": [
                "alpha",
                "beta",
                "live"
            ]
        },
        "previous_version": {
            "type": "string"
        },
        "public_updated_at": {
            "$ref": "#/definitions/public_updated_at"
        },
        "publishing_app": {
            "$ref": "#/definitions/publishing_app_name"
        },
        "redirects": {
            "type": "array",
            "additionalItems": false,
            "items": {}
        },
        "rendering_app": {
            "$ref": "#/definitions/rendering_app"
        },
        "routes": {
            "$ref": "#/definitions/routes"
        },
        "schema_name": {
            "type": "string",
            "enum": [
                "publication"
            ]
        },
        "title": {
            "$ref": "#/definitions/title"
        },
        "update_type": {
            "$ref": "#/definitions/update_type"
        }
    },
    "definitions": {
        "description": {
            "type": "string"
        },
        "absolute_path": {
            "description": "A path only. Query string and/or fragment are not allowed.",
            "type": "string",
            "pattern": "^/(([a-zA-Z0-9._~!$&'()*+,;=:@-]|%[0-9a-fA-F]{2})+(/([a-zA-Z0-9._~!$&'()*+,;=:@-]|%[0-9a-fA-F]{2})*)*)?$"
        },
        "access_limited": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "auth_bypass_ids": {
                    "description": "Deprecated: auth_bypass_ids should be sent as a separate field",
                    "$ref": "#/definitions/guid_list"
                },
                "organisations": {
                    "description": "A list of organisation content ids permitted access to this item",
                    "$ref": "#/definitions/guid_list"
                },
                "users": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            }
        },
        "analytics_identifier": {
            "description": "A short identifier we send to Google Analytics for multi-valued fields. This means we avoid the truncated values we would get if we sent the path or slug of eg organisations.",
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ]
        },
        "attachments_with_thumbnails": {
            "description": "An ordered list of attachments",
            "type": "array",
            "items": {
                "description": "Generated HTML for each attachment including thumbnail and download link",
                "type": "string"
            }
        },
        "body": {
            "description": "The main content provided as HTML rendered from govspeak",
            "type": "string"
        },
        "brexit_no_deal_notice": {
            "description": "A list of URLs and titles for a brexit no deal notice.",
            "type": "array",
            "items": {
                "type": "object",
                "required": [
                    "title",
                    "href"
                ],
                "additionalProperties": false,
                "properties": {
                    "href": {
                        "type": "string"
                    },
                    "title": {
                        "type": "string"
                    }
                }
            }
        },
        "change_history": {
            "type": "array",
            "items": {
                "type": "object",
                "required": [
                    "public_timestamp",
                    "note"
                ],
                "additionalProperties": false,
                "properties": {
                    "note": {
                        "description": "A summary of the change",
                        "type": "string"
                    },
                    "public_timestamp": {
                        "type": "string",
                        "format": "date-time"
                    }
                }
            }
        },
        "description_optional": {
            "anyOf": [
                {
                    "$ref": "#/definitions/description"
                },
                {
                    "type": "null"
                }
            ]
        },
        "details": {
            "type": "object",
            "required": [
                "body",
                "documents",
                "political"
            ],
            "additionalProperties": false,
            "properties": {
                "attachments": {
                    "description": "An ordered list of asset links",
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/publication_attachment_asset"
                    }
                },
                "body": {
                    "$ref": "#/definitions/body"
                },
                "brexit_no_deal_notice": {
                    "$ref": "#/definitions/brexit_no_deal_notice"
                },
                "change_history": {
                    "$ref": "#/definitions/change_history"
                },
                "documents": {
                    "$ref": "#/definitions/attachments_with_thumbnails"
                },
                "emphasised_organisations": {
                    "$ref": "#/definitions/emphasised_organisations"
                },
                "featured_attachments": {
                    "description": "An ordered list of attachments to feature below the document",
                    "type": "array",
                    "items": {
                        "type": "string"
                    },
                    "_uniqueItems": true
                },
                "first_public_at": {
                    "$ref": "#/definitions/first_public_at"
                },
                "government": {
                    "$ref": "#/definitions/government"
                },
                "national_applicability": {
                    "$ref": "#/definitions/national_applicability"
                },
                "political": {
                    "$ref": "#/definitions/political"
                },
                "tags": {
                    "$ref": "#/definitions/tags"
                }
            }
        },
        "emphasised_organisations": {
            "description": "The content ids of the organisations that should be displayed first in the list of organisations related to the item, these content ids must be present in the item organisation links hash.",
            "type": "array",
            "items": {
                "$ref": "#/definitions/guid"
            }
        },
        "first_public_at": {
            "description": "DEPRECATED. The date the content was first published. Used in details. Deprecated in favour of top level `first_published_at`.",
            "type": "string",
            "format": "date-time"
        },
        "first_published_at": {
            "description": "The date the content was first published.  Automatically determined by the publishing-api, unless overridden by the publishing application.",
            "type": "string",
            "format": "date-time"
        },
        "government": {
            "description": "DEPRECATED: Content should be associated with a government through a link",
            "type": "object",
            "required": [
                "title",
                "slug",
                "current"
            ],
            "additionalProperties": false,
            "properties": {
                "current": {
                    "description": "Is the government that published this document still the current government.",
                    "type": "boolean"
                },
                "slug": {
                    "description": "Government slug, used for analytics, eg '1970-to-1974-conservative-government'.",
                    "type": "string"
                },
                "title": {
                    "description": "Name of the government that first published this document, eg '1970 to 1974 Conservative government'.",
                    "type": "string"
                }
            }
        },
        "guid": {
            "type": "string",
            "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
        },
        "guid_list": {
            "type": "array",
            "items": {
                "$ref": "#/definitions/guid"
            },
            "_uniqueItems": true
        },
        "locale": {
            "type": "string",
            "enum": [
                "ar",
                "az",
                "be",
                "bg",
                "bn",
                "cs",
                "cy",
                "da",
                "de",
                "dr",
                "el",
                "en",
                "es",
                "es-419",
                "et",
                "fa",
                "fi",
                "fr",
                "gd",
                "he",
                "hi",
                "hr",
                "hu",
                "hy",
                "id",
                "is",
                "it",
                "ja",
                "ka",
                "kk",
                "ko",
                "lt",
                "lv",
                "ms",
                "mt",
                "nl",
                "no",
                "pl",
                "ps",
                "pt",
                "ro",
                "ru",
                "si",
                "sk",
                "sl",
                "so",
                "sq",
                "sr",
                "sv",
                "sw",
                "ta",
                "th",
                "tk",
                "tr",
                "uk",
                "ur",
                "uz",
                "vi",
                "zh",
                "zh-hk",
                "zh-tw"
            ]
        },
        "nation_applicability": {
            "description": "An object specifying the applicability of a particular nation.",
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "alternative_url": {
                    "description": "An optional alternative URL to link to for more information on this content item pertaining to this nation.",
                    "type": "string"
                },
                "applicable": {
                    "description": "Whether the content applies to this nation or not.",
                    "type": "boolean"
                },
                "label": {
                    "description": "The pretty-printed, translated label for this nation.",
                    "type": "string"
                }
            }
        },
        "national_applicability": {
            "description": "An object specifying the applicable nations for this content item. If it applies to all nations, it should be omitted.",
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "england": {
                    "$ref": "#/definitions/nation_applicability"
                },
                "northern_ireland": {
                    "$ref": "#/definitions/nation_applicability"
                },
                "scotland": {
                    "$ref": "#/definitions/nation_applicability"
                },
                "wales": {
                    "$ref": "#/definitions/nation_applicability"
                }
            }
        },
        "political": {
            "description": "If the content is considered political in nature, reflecting views of the government it was published under.",
            "type": "boolean"
        },
        "public_updated_at": {
            "description": "When the content was last significantly changed (a major update). Shown to users.  Automatically determined by the publishing-api, unless overridden by the publishing application.",
            "type": "string",
            "format": "date-time"
        },
        "publication_attachment_asset": {
            "oneOf": [
                {
                    "type": "object",
                    "required": [
                        "attachment_type",
                        "content_type",
                        "id",
                        "url"
                    ],
                    "additionalProperties": false,
                    "properties": {
                        "accessible": {
                            "type": "boolean"
                        },
                        "alternative_format_contact_email": {
                            "type": "string"
                        },
                        "attachment_type": {
                            "type": "string",
                            "enum": [
                                "file"
                            ]
                        },
                        "command_paper_number": {
                            "type": "string"
                        },
                        "content_type": {
                            "type": "string"
                        },
                        "file_size": {
                            "type": "integer"
                        },
                        "filename": {
                            "type": "string"
                        },
                        "hoc_paper_number": {
                            "type": "string"
                        },
                        "id": {
                            "type": "string"
                        },
                        "isbn": {
                            "type": "string"
                        },
                        "locale": {
                            "$ref": "#/definitions/locale"
                        },
                        "number_of_pages": {
                            "type": "integer"
                        },
                        "parliamentary_session": {
                            "type": "string"
                        },
                        "preview_url": {
                            "type": "string",
                            "format": "uri"
                        },
                        "title": {
                            "type": "string"
                        },
                        "unique_reference": {
                            "type": "string"
                        },
                        "unnumbered_command_paper": {
                            "type": "boolean"
                        },
                        "unnumbered_hoc_paper": {
                            "type": "boolean"
                        },
                        "url": {
                            "type": "string",
                            "format": "uri"
                        }
                    }
                },
                {
                    "type": "object",
                    "required": [
                        "attachment_type",
                        "id",
                        "url"
                    ],
                    "additionalProperties": false,
                    "properties": {
                        "attachment_type": {
                            "type": "string",
                            "enum": [
                                "html"
                            ]
                        },
                        "command_paper_number": {
                            "type": "string"
                        },
                        "hoc_paper_number": {
                            "type": "string"
                        },
                        "id": {
                            "type": "string"
                        },
                        "isbn": {
                            "type": "string"
                        },
                        "locale": {
                            "$ref": "#/definitions/locale"
                        },
                        "parliamentary_session": {
                            "type": "string"
                        },
                        "title": {
                            "type": "string"
                        },
                        "unique_reference": {
                            "type": "string"
                        },
                        "unnumbered_command_paper": {
                            "type": "boolean"
                        },
                        "unnumbered_hoc_paper": {
                            "type": "boolean"
                        },
                        "url": {
                            "type": "string",
                            "format": "uri"
                        }
                    }
                },
                {
                    "type": "object",
                    "required": [
                        "attachment_type",
                        "id",
                        "url"
                    ],
                    "additionalProperties": false,
                    "properties": {
                        "attachment_type": {
                            "type": "string",
                            "enum": [
                                "external"
                            ]
                        },
                        "command_paper_number": {
                            "type": "string"
                        },
                        "hoc_paper_number": {
                            "type": "string"
                        },
                        "id": {
                            "type": "string"
                        },
                        "isbn": {
                            "type": "string"
                        },
                        "locale": {
                            "$ref": "#/definitions/locale"
                        },
                        "parliamentary_session": {
                            "type": "string"
                        },
                        "title": {
                            "type": "string"
                        },
                        "unique_reference": {
                            "type": "string"
                        },
                        "unnumbered_command_paper": {
                            "type": "boolean"
                        },
                        "unnumbered_hoc_paper": {
                            "type": "boolean"
                        },
                        "url": {
                            "type": "string",
                            "format": "uri"
                        }
                    }
                }
            ]
        },
        "publishing_app_name": {
            "description": "The application that published this item.",
            "type": "string",
            "enum": [
                "calculators",
                "calendars",
                "collections-publisher",
                "contacts",
                "content-publisher",
                "content-tagger",
                "email-alert-frontend",
                "external-link-tracker",
                "feedback",
                "frontend",
                "government-frontend",
                "hmrc-manuals-api",
                "info-frontend",
                "licencefinder",
                "local-links-manager",
                "manuals-frontend",
                "manuals-publisher",
                "maslow",
                "performanceplatform-big-screen-view",
                "publisher",
                "rummager",
                "search-admin",
                "search-api",
                "service-manual-publisher",
                "share-sale-publisher",
                "short-url-manager",
                "smartanswers",
                "special-route-publisher",
                "specialist-publisher",
                "static",
                "tariff",
                "travel-advice-publisher",
                "whitehall"
            ]
        },
        "rendering_app": {
            "description": "The application that renders this item.",
            "type": "string",
            "enum": [
                "calculators",
                "calendars",
                "collections",
                "content-store",
                "email-alert-frontend",
                "email-campaign-frontend",
                "feedback",
                "finder-frontend",
                "frontend",
                "government-frontend",
                "info-frontend",
                "licencefinder",
                "manuals-frontend",
                "performanceplatform-big-screen-view",
                "rummager",
                "search-api",
                "service-manual-frontend",
                "smartanswers",
                "spotlight",
                "static",
                "tariff",
                "whitehall-admin",
                "whitehall-frontend"
            ]
        },
        "route": {
            "type": "object",
            "required": [
                "path",
                "type"
            ],
            "additionalProperties": false,
            "properties": {
                "path": {
                    "type": "string"
                },
                "type": {
                    "enum": [
                        "prefix",
                        "exact"
                    ]
                }
            }
        },
        "routes": {
            "type": "array",
            "items": {
                "$ref": "#/definitions/route"
            },
            "minItems": 1
        },
        "tags": {
            "description": "Field used by email-alert-api to trigger email alerts for subscriptions to topics (gov.uk/topic) and policies (gov.uk/policies).",
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "additional_topics": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "browse_pages": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "policies": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "primary_topic": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "topics": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            }
        },
        "title": {
            "type": "string"
        },
        "update_type": {
            "enum": [
                "major",
                "minor",
                "republish"
            ]
        }
    }
}