{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/prostitutionlaws/json-schema/prostitutionlaws-index-document-schema.json",
  "title": "IndexDocument",
  "x-generated": "2026-11-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/prostitutionlaws-api-openapi.json#/components/schemas/IndexDocument",
  "type": "object",
  "required": [
    "countries",
    "generated"
  ],
  "properties": {
    "site": {
      "type": "string",
      "description": "\"Prostitution Laws\""
    },
    "url": {
      "type": "string",
      "description": "The site",
      "format": "uri"
    },
    "license": {
      "type": "string",
      "description": "CC BY 4.0"
    },
    "attribution": {
      "type": "string",
      "description": "The credit line the licence asks for"
    },
    "disclaimer": {
      "type": "string",
      "description": "Not legal advice"
    },
    "generated": {
      "type": "string",
      "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$",
      "description": "YYYY, YYYY-MM or YYYY-MM-DD"
    },
    "countries": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/IndexEntry"
      }
    }
  },
  "$defs": {
    "IndexEntry": {
      "type": "object",
      "required": [
        "iso2",
        "name",
        "aliases",
        "slug",
        "region",
        "regionLabel",
        "model",
        "depth",
        "lastReviewed",
        "topics",
        "subnational",
        "pending",
        "url",
        "markdown",
        "json"
      ],
      "additionalProperties": false,
      "properties": {
        "iso2": {
          "type": "string",
          "description": "ISO 3166-1 alpha-2, upper case",
          "pattern": "^[A-Z]{2}$"
        },
        "name": {
          "type": "string",
          "description": "English name"
        },
        "nativeName": {
          "type": "string",
          "description": "Name in the main local language"
        },
        "aliases": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Other English names and the ISO alpha-3 code"
        },
        "slug": {
          "type": "string",
          "description": "URL slug of the profile"
        },
        "region": {
          "type": "string",
          "enum": [
            "europe",
            "north-america",
            "latin-america",
            "middle-east",
            "africa",
            "asia",
            "oceania",
            "other"
          ]
        },
        "regionLabel": {
          "type": "string",
          "description": "Region name"
        },
        "model": {
          "type": "string",
          "enum": [
            "decriminalisation",
            "regulation",
            "abolitionism",
            "neo-abolitionism",
            "prohibition"
          ],
          "description": "Legal model"
        },
        "depth": {
          "type": "string",
          "enum": [
            "profile",
            "overview"
          ],
          "description": "Full profile (all 11 questions) or overview (5 core questions)"
        },
        "lastReviewed": {
          "type": "string",
          "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$",
          "description": "YYYY, YYYY-MM or YYYY-MM-DD"
        },
        "topics": {
          "type": "object",
          "description": "The status of each question the entry answers",
          "propertyNames": {
            "enum": [
              "selling",
              "buying",
              "brothels",
              "sharedPremises",
              "procuring",
              "advertising",
              "platforms",
              "street",
              "registration",
              "tax",
              "migrants"
            ]
          },
          "additionalProperties": {
            "type": "string",
            "enum": [
              "legal",
              "regulated",
              "restricted",
              "illegal",
              "varies"
            ]
          }
        },
        "subnational": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Regions whose rules differ"
        },
        "pending": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "id",
              "title",
              "stage",
              "updated"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "stage": {
                "type": "string"
              },
              "updated": {
                "type": "string",
                "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$",
                "description": "YYYY, YYYY-MM or YYYY-MM-DD"
              },
              "next": {
                "type": "object",
                "properties": {
                  "date": {
                    "type": "string",
                    "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$",
                    "description": "YYYY, YYYY-MM or YYYY-MM-DD"
                  },
                  "what": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "url": {
          "type": "string",
          "description": "The HTML profile",
          "format": "uri"
        },
        "markdown": {
          "type": "string",
          "description": "The profile as Markdown",
          "format": "uri"
        },
        "json": {
          "type": "string",
          "description": "The profile as JSON (/data/countries/{iso2}.json)",
          "format": "uri"
        }
      }
    }
  }
}