{
    "$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": [
                "step_by_step_nav"
            ]
        },
        "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": {
                "pages_part_of_step_nav": {
                    "description": "A list of content that should be navigable via this step by step journey",
                    "$ref": "#/definitions/guid_list"
                },
                "pages_related_to_step_nav": {
                    "description": "A list of content that is related to this step by step navigation journey",
                    "$ref": "#/definitions/guid_list"
                },
                "pages_secondary_to_step_nav": {
                    "description": "A list of content items that may be a part of but not essential to completing this step by step navigation journey.",
                    "$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": [
                "step_by_step_nav"
            ]
        },
        "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_html_and_govspeak": {
            "description": "The main content provided as HTML with the govspeak markdown it's rendered from",
            "anyOf": [
                {
                    "$ref": "#/definitions/multiple_content_types"
                }
            ]
        },
        "description_optional": {
            "anyOf": [
                {
                    "$ref": "#/definitions/description"
                },
                {
                    "type": "null"
                }
            ]
        },
        "details": {
            "type": "object",
            "required": [
                "step_by_step_nav"
            ],
            "additionalProperties": false,
            "properties": {
                "step_by_step_nav": {
                    "$ref": "#/definitions/step_by_step_nav"
                }
            }
        },
        "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
        },
        "individual_step": {
            "type": "object",
            "required": [
                "title",
                "contents"
            ],
            "additionalProperties": false,
            "properties": {
                "contents": {
                    "type": "array",
                    "items": {
                        "oneOf": [
                            {
                                "$ref": "#/definitions/step_item_paragraph"
                            },
                            {
                                "$ref": "#/definitions/step_item_list"
                            }
                        ]
                    }
                },
                "logic": {
                    "type": "string",
                    "enum": [
                        "and",
                        "or"
                    ]
                },
                "title": {
                    "type": "string"
                }
            }
        },
        "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"
            ]
        },
        "multiple_content_types": {
            "type": "array",
            "items": {
                "type": "object",
                "required": [
                    "content_type",
                    "content"
                ],
                "additionalProperties": false,
                "properties": {
                    "content": {
                        "type": "string"
                    },
                    "content_type": {
                        "type": "string"
                    }
                }
            }
        },
        "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
        },
        "step_by_step_nav": {
            "type": "object",
            "required": [
                "title",
                "introduction",
                "steps"
            ],
            "additionalProperties": false,
            "properties": {
                "introduction": {
                    "$ref": "#/definitions/body_html_and_govspeak"
                },
                "steps": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/individual_step"
                    }
                },
                "title": {
                    "type": "string"
                }
            }
        },
        "step_item_list": {
            "type": "object",
            "required": [
                "type",
                "contents"
            ],
            "additionalProperties": false,
            "properties": {
                "contents": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "required": [
                            "text"
                        ],
                        "additionalProperties": false,
                        "properties": {
                            "context": {
                                "type": "string"
                            },
                            "href": {
                                "type": "string",
                                "format": "uri"
                            },
                            "text": {
                                "type": "string"
                            }
                        }
                    }
                },
                "style": {
                    "type": "string",
                    "enum": [
                        "choice",
                        "required",
                        "optional"
                    ]
                },
                "type": {
                    "type": "string"
                }
            }
        },
        "step_item_paragraph": {
            "type": "object",
            "required": [
                "type",
                "text"
            ],
            "additionalProperties": false,
            "properties": {
                "text": {
                    "type": "string"
                },
                "type": {
                    "type": "string"
                }
            }
        },
        "title": {
            "type": "string"
        },
        "update_type": {
            "enum": [
                "major",
                "minor",
                "republish"
            ]
        }
    }
}