{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/prostitutionlaws/json-schema/prostitutionlaws-all-countries-schema.json",
  "title": "AllCountries",
  "x-generated": "2026-11-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/prostitutionlaws-api-openapi.json#/components/schemas/AllCountries",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Dataset name"
    },
    "license": {
      "type": "string",
      "description": "CC BY 4.0"
    },
    "url": {
      "type": "string",
      "description": "The site",
      "format": "uri"
    },
    "generated": {
      "type": "string",
      "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$",
      "description": "YYYY, YYYY-MM or YYYY-MM-DD"
    },
    "countries": {
      "type": "array",
      "items": {
        "allOf": [
          {
            "$ref": "#/$defs/Country"
          }
        ],
        "properties": {
          "url": {
            "type": "string",
            "description": "The HTML profile",
            "format": "uri"
          }
        }
      }
    }
  },
  "$defs": {
    "Country": {
      "type": "object",
      "properties": {
        "iso2": {
          "type": "string",
          "minLength": 2,
          "maxLength": 2
        },
        "name": {
          "type": "string"
        },
        "nativeName": {
          "type": "string"
        },
        "slug": {
          "type": "string",
          "pattern": "^[a-z0-9-]+$"
        },
        "memberships": {
          "default": [],
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "EU",
              "EEA",
              "EFTA",
              "CoE",
              "Schengen"
            ]
          }
        },
        "depth": {
          "type": "string",
          "enum": [
            "profile",
            "overview"
          ]
        },
        "lastReviewed": {
          "type": "string",
          "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$"
        },
        "model": {
          "type": "string",
          "enum": [
            "decriminalisation",
            "regulation",
            "abolitionism",
            "neo-abolitionism",
            "prohibition"
          ]
        },
        "modelNote": {
          "type": "string",
          "minLength": 20,
          "maxLength": 600
        },
        "modelSources": {
          "minItems": 1,
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "summary": {
          "type": "string",
          "minLength": 40,
          "maxLength": 900
        },
        "subnational": {
          "default": [],
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "model": {
                "type": "string",
                "enum": [
                  "decriminalisation",
                  "regulation",
                  "abolitionism",
                  "neo-abolitionism",
                  "prohibition"
                ]
              },
              "note": {
                "type": "string"
              },
              "sources": {
                "minItems": 1,
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "name",
              "note",
              "sources"
            ],
            "additionalProperties": false
          }
        },
        "topics": {
          "type": "object",
          "propertyNames": {
            "type": "string",
            "enum": [
              "selling",
              "buying",
              "brothels",
              "sharedPremises",
              "procuring",
              "advertising",
              "platforms",
              "street",
              "registration",
              "tax",
              "migrants"
            ]
          },
          "additionalProperties": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "legal",
                  "regulated",
                  "restricted",
                  "illegal",
                  "varies"
                ]
              },
              "penalty": {
                "type": "string",
                "enum": [
                  "criminal",
                  "administrative",
                  "none"
                ]
              },
              "summary": {
                "type": "string",
                "minLength": 20,
                "maxLength": 500
              },
              "details": {
                "type": "string"
              },
              "provisions": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "sources": {
                "minItems": 1,
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "verified": {
                "type": "string",
                "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$"
              },
              "confidence": {
                "default": "high",
                "type": "string",
                "enum": [
                  "high",
                  "medium",
                  "low"
                ]
              },
              "note": {
                "type": "string"
              },
              "mapLabel": {
                "type": "string",
                "maxLength": 28
              }
            },
            "required": [
              "status",
              "summary",
              "sources",
              "verified",
              "confidence"
            ],
            "additionalProperties": false
          }
        },
        "laws": {
          "default": [],
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "sourceId": {
                "type": "string"
              },
              "titleEn": {
                "type": "string"
              },
              "relevance": {
                "type": "string",
                "minLength": 10
              },
              "provisions": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "inForce": {
                "type": "string",
                "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$"
              }
            },
            "required": [
              "sourceId",
              "titleEn",
              "relevance"
            ],
            "additionalProperties": false
          }
        },
        "pending": {
          "default": [],
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-z0-9-]+$"
              },
              "title": {
                "type": "string"
              },
              "stage": {
                "type": "string",
                "enum": [
                  "proposed",
                  "consultation",
                  "in-parliament",
                  "adopted",
                  "review",
                  "stalled",
                  "rejected"
                ]
              },
              "updated": {
                "type": "string",
                "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$"
              },
              "next": {
                "type": "object",
                "properties": {
                  "date": {
                    "type": "string",
                    "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$"
                  },
                  "what": {
                    "type": "string"
                  }
                },
                "required": [
                  "what"
                ],
                "additionalProperties": false
              },
              "summary": {
                "type": "string",
                "minLength": 20
              },
              "sources": {
                "minItems": 1,
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "id",
              "title",
              "stage",
              "updated",
              "summary",
              "sources"
            ],
            "additionalProperties": false
          }
        },
        "timeline": {
          "default": [],
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "date": {
                "type": "string",
                "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$"
              },
              "event": {
                "type": "string",
                "minLength": 10
              },
              "sources": {
                "minItems": 1,
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "date",
              "event",
              "sources"
            ],
            "additionalProperties": false
          }
        },
        "stats": {
          "default": [],
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string"
              },
              "value": {
                "type": "string"
              },
              "year": {
                "type": "string"
              },
              "note": {
                "type": "string"
              },
              "sources": {
                "minItems": 1,
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "label",
              "value",
              "year",
              "sources"
            ],
            "additionalProperties": false
          }
        },
        "sources": {
          "minItems": 1,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-z0-9-]+$"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "legislation",
                  "case-law",
                  "government",
                  "parliament",
                  "statistics",
                  "intergovernmental",
                  "academic",
                  "ngo",
                  "news"
                ]
              },
              "title": {
                "type": "string",
                "minLength": 3
              },
              "titleEn": {
                "type": "string"
              },
              "publisher": {
                "type": "string",
                "minLength": 2
              },
              "url": {
                "type": "string",
                "format": "uri"
              },
              "published": {
                "type": "string",
                "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$"
              },
              "accessed": {
                "type": "string",
                "pattern": "^\\d{4}(-\\d{2}(-\\d{2})?)?$"
              },
              "lang": {
                "type": "string",
                "minLength": 2,
                "maxLength": 5
              }
            },
            "required": [
              "id",
              "kind",
              "title",
              "publisher",
              "url",
              "accessed",
              "lang"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "iso2",
        "name",
        "memberships",
        "depth",
        "lastReviewed",
        "model",
        "modelNote",
        "modelSources",
        "summary",
        "subnational",
        "topics",
        "laws",
        "pending",
        "timeline",
        "stats",
        "sources"
      ]
    }
  }
}