{
    "$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": [
                "organisation"
            ]
        },
        "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": {
                "ordered_board_members": {
                    "description": "Board members primarily for use with Whitehall organisations.",
                    "$ref": "#/definitions/guid_list"
                },
                "ordered_chief_professional_officers": {
                    "description": "Chief professional officers primarily for use with Whitehall organisations.",
                    "$ref": "#/definitions/guid_list"
                },
                "ordered_child_organisations": {
                    "description": "Child organisations primarily for use with Whitehall organisations.",
                    "$ref": "#/definitions/guid_list"
                },
                "ordered_contacts": {
                    "description": "Contact details primarily for use with Whitehall organisations.",
                    "$ref": "#/definitions/guid_list"
                },
                "ordered_featured_policies": {
                    "description": "Featured policies primarily for use with Whitehall organisations.",
                    "$ref": "#/definitions/guid_list"
                },
                "ordered_foi_contacts": {
                    "description": "FoI contact details primarily for use with Whitehall organisations.",
                    "$ref": "#/definitions/guid_list"
                },
                "ordered_high_profile_groups": {
                    "description": "High profile groups primarily for use with Whitehall organisations.",
                    "$ref": "#/definitions/guid_list"
                },
                "ordered_military_personnel": {
                    "description": "Military personnel primarily for use with Whitehall organisations.",
                    "$ref": "#/definitions/guid_list"
                },
                "ordered_ministers": {
                    "description": "Ministers primarily for use with Whitehall organisations.",
                    "$ref": "#/definitions/guid_list"
                },
                "ordered_parent_organisations": {
                    "description": "Parent organisations primarily for use with Whitehall organisations.",
                    "$ref": "#/definitions/guid_list"
                },
                "ordered_roles": {
                    "description": "Organisational roles primarily for use with Whitehall organisations.",
                    "$ref": "#/definitions/guid_list"
                },
                "ordered_special_representatives": {
                    "description": "Special representatives primarily for use with Whitehall organisations.",
                    "$ref": "#/definitions/guid_list"
                },
                "ordered_successor_organisations": {
                    "description": "Successor organisations primarily for use with closed Whitehall organisations.",
                    "$ref": "#/definitions/guid_list"
                },
                "ordered_traffic_commissioners": {
                    "description": "Traffic commissioners primarily for use with Whitehall organisations.",
                    "$ref": "#/definitions/guid_list"
                },
                "policy_areas": {
                    "description": "A largely deprecated tag currently only used to power email alerts.",
                    "$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": [
                "organisation"
            ]
        },
        "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"
                }
            ]
        },
        "body": {
            "description": "The main content provided as HTML rendered from govspeak",
            "type": "string"
        },
        "change_note": {
            "description": "Change note for the most recent update",
            "type": [
                "string",
                "null"
            ]
        },
        "description_optional": {
            "anyOf": [
                {
                    "$ref": "#/definitions/description"
                },
                {
                    "type": "null"
                }
            ]
        },
        "details": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "acronym": {
                    "description": "The organisation's acronym, if it has one.",
                    "type": [
                        "string",
                        "null"
                    ]
                },
                "alternative_format_contact_email": {
                    "description": "The organisation's email for requesting an alternative format for attachments",
                    "type": [
                        "string",
                        "null"
                    ]
                },
                "analytics_identifier": {
                    "$ref": "#/definitions/analytics_identifier"
                },
                "body": {
                    "$ref": "#/definitions/body"
                },
                "brand": {
                    "description": "The organisation's brand class name, which is mapped to a colour in the frontend.",
                    "type": [
                        "string",
                        "null"
                    ]
                },
                "change_note": {
                    "$ref": "#/definitions/change_note"
                },
                "default_news_image": {
                    "$ref": "#/definitions/image"
                },
                "external_related_links": {
                    "$ref": "#/definitions/external_related_links"
                },
                "foi_exempt": {
                    "description": "Whether the organisation is exempt from Freedom of Information requests.",
                    "type": "boolean"
                },
                "important_board_members": {
                    "description": "The number of board members that will have photos displayed for them.",
                    "type": "integer"
                },
                "logo": {
                    "description": "The organisation's logo, including the logo image and formatted name.",
                    "type": "object",
                    "properties": {
                        "crest": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "enum": [
                                "bis",
                                "dit",
                                "eo",
                                "hmrc",
                                "ho",
                                "mod",
                                "portcullis",
                                "single-identity",
                                "so",
                                "ukaea",
                                "wales",
                                null
                            ]
                        },
                        "formatted_title": {
                            "type": "string"
                        },
                        "image": {
                            "$ref": "#/definitions/image"
                        }
                    }
                },
                "ordered_corporate_information_pages": {
                    "description": "A set of links to corporate information pages to display for the organisation.",
                    "type": "array",
                    "items": {
                        "type": "object",
                        "required": [
                            "title",
                            "href"
                        ],
                        "additionalProperties": false,
                        "properties": {
                            "href": {
                                "type": "string"
                            },
                            "title": {
                                "type": "string"
                            }
                        }
                    }
                },
                "ordered_featured_documents": {
                    "description": "A set of featured documents to display for the organisation. Turn into proper links once organisations are fully migrated.",
                    "type": "array",
                    "items": {
                        "type": "object",
                        "required": [
                            "title",
                            "href",
                            "image",
                            "summary",
                            "public_updated_at",
                            "document_type"
                        ],
                        "additionalProperties": false,
                        "properties": {
                            "document_type": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "href": {
                                "type": "string"
                            },
                            "image": {
                                "$ref": "#/definitions/image"
                            },
                            "public_updated_at": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "summary": {
                                "type": "string"
                            },
                            "title": {
                                "type": "string"
                            }
                        }
                    }
                },
                "ordered_featured_links": {
                    "description": "A set of featured links to display for the organisation.",
                    "type": "array",
                    "items": {
                        "type": "object",
                        "required": [
                            "title",
                            "href"
                        ],
                        "additionalProperties": false,
                        "properties": {
                            "href": {
                                "type": "string"
                            },
                            "title": {
                                "type": "string"
                            }
                        }
                    }
                },
                "ordered_promotional_features": {
                    "description": "A set of promotional features to display for the organisation. Turn into proper links once organisations are fully migrated.",
                    "type": "array",
                    "items": {
                        "type": "object",
                        "required": [
                            "title",
                            "items"
                        ],
                        "additionalProperties": false,
                        "properties": {
                            "items": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "required": [
                                        "summary",
                                        "double_width"
                                    ],
                                    "additionalProperties": false,
                                    "properties": {
                                        "double_width": {
                                            "type": "boolean"
                                        },
                                        "href": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "image": {
                                            "$ref": "#/definitions/image"
                                        },
                                        "links": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "required": [
                                                    "title",
                                                    "href"
                                                ],
                                                "additionalProperties": false,
                                                "properties": {
                                                    "href": {
                                                        "type": "string"
                                                    },
                                                    "title": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        },
                                        "summary": {
                                            "type": "string"
                                        },
                                        "title": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        }
                                    }
                                }
                            },
                            "title": {
                                "type": "string"
                            }
                        }
                    }
                },
                "organisation_featuring_priority": {
                    "description": "Whether to prioritise news or services on the organisation's home page.",
                    "type": "string",
                    "enum": [
                        "news",
                        "service"
                    ]
                },
                "organisation_govuk_status": {
                    "description": "The status of the organisation on GOV.UK.",
                    "type": "object",
                    "required": [
                        "status"
                    ],
                    "additionalProperties": false,
                    "properties": {
                        "status": {
                            "type": "string",
                            "enum": [
                                "changed_name",
                                "devolved",
                                "exempt",
                                "joining",
                                "left_gov",
                                "live",
                                "merged",
                                "no_longer_exists",
                                "replaced",
                                "split",
                                "superseded_by_devolved_administration",
                                "transitioning"
                            ]
                        },
                        "updated_at": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "format": "date-time"
                        },
                        "url": {
                            "type": [
                                "string",
                                "null"
                            ]
                        }
                    }
                },
                "organisation_political": {
                    "description": "Determines whether content published by this organisation represents governments policies and can be eligible for history mode",
                    "type": "boolean"
                },
                "organisation_type": {
                    "description": "The type of organisation.",
                    "type": "string",
                    "enum": [
                        "adhoc_advisory_group",
                        "advisory_ndpb",
                        "civil_service",
                        "court",
                        "devolved_administration",
                        "executive_agency",
                        "executive_ndpb",
                        "executive_office",
                        "independent_monitoring_body",
                        "ministerial_department",
                        "non_ministerial_department",
                        "other",
                        "public_corporation",
                        "sub_organisation",
                        "tribunal"
                    ]
                },
                "secondary_corporate_information_pages": {
                    "description": "A string containing sentences and links to corporate information pages that are not included in ordered_corporate_information_pages.",
                    "type": "string"
                },
                "social_media_links": {
                    "description": "A set of links to social media profiles for the organisation.",
                    "type": "array",
                    "items": {
                        "type": "object",
                        "required": [
                            "service_type",
                            "title",
                            "href"
                        ],
                        "additionalProperties": false,
                        "properties": {
                            "href": {
                                "type": "string",
                                "format": "uri"
                            },
                            "service_type": {
                                "type": "string",
                                "enum": [
                                    "blog",
                                    "email",
                                    "facebook",
                                    "flickr",
                                    "foursquare",
                                    "google-plus",
                                    "instagram",
                                    "linkedin",
                                    "other",
                                    "pinterest",
                                    "twitter",
                                    "youtube"
                                ]
                            },
                            "title": {
                                "type": "string"
                            }
                        }
                    }
                }
            }
        },
        "external_link": {
            "type": "object",
            "required": [
                "title",
                "url"
            ],
            "additionalProperties": false,
            "properties": {
                "title": {
                    "type": "string"
                },
                "url": {
                    "type": "string",
                    "format": "uri"
                }
            }
        },
        "external_related_links": {
            "type": "array",
            "items": {
                "$ref": "#/definitions/external_link"
            }
        },
        "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"
        },
        "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
        },
        "image": {
            "type": "object",
            "required": [
                "url"
            ],
            "additionalProperties": false,
            "properties": {
                "alt_text": {
                    "type": "string"
                },
                "caption": {
                    "anyOf": [
                        {
                            "type": "string"
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "credit": {
                    "anyOf": [
                        {
                            "type": "string"
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "high_resolution_url": {
                    "description": "URL to a high resolution version of the image, for use by third parties such as Twitter, Facebook or Slack. Used by the machine readable metadata component. Don't use this on user-facing web pages, as it might be very large.",
                    "type": "string",
                    "format": "uri"
                },
                "url": {
                    "description": "URL to the image. The image should be in a suitable resolution for display on the page.",
                    "type": "string",
                    "format": "uri"
                }
            }
        },
        "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"
            ]
        },
        "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"
        },
        "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
        },
        "title": {
            "type": "string"
        },
        "update_type": {
            "enum": [
                "major",
                "minor",
                "republish"
            ]
        }
    }
}