{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ivans/json-schema/ivans-country-schema.json",
  "title": "Country",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ivans-geos-api-openapi.yml#/components/schemas/Country",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer",
      "readOnly": true
    },
    "subdivisions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Subdivision"
      }
    },
    "uuid": {
      "type": "string",
      "format": "uuid",
      "readOnly": true
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "readOnly": true
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "readOnly": true
    },
    "name": {
      "type": "string",
      "maxLength": 128
    },
    "alpha3": {
      "type": [
        "string",
        "null"
      ],
      "maxLength": 3
    },
    "alpha2": {
      "type": [
        "string",
        "null"
      ],
      "maxLength": 2
    },
    "numerical": {
      "type": [
        "integer",
        "null"
      ],
      "maximum": 2147483647,
      "minimum": -2147483648
    }
  },
  "required": [
    "createdAt",
    "id",
    "name",
    "subdivisions",
    "updatedAt",
    "uuid"
  ],
  "$defs": {
    "Subdivision": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "readOnly": true
        },
        "childSubdivisions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Subdivision"
          }
        },
        "uuid": {
          "type": "string",
          "format": "uuid",
          "readOnly": true
        },
        "createdAt": {
          "type": "string",
          "format": "date-time",
          "readOnly": true
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time",
          "readOnly": true
        },
        "name": {
          "type": "string",
          "maxLength": 128
        },
        "alpha3": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 3
        },
        "alpha2": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 2
        },
        "numerical": {
          "type": [
            "integer",
            "null"
          ],
          "maximum": 2147483647,
          "minimum": -2147483648
        },
        "subdivisionType": {
          "allOf": [
            {
              "$ref": "#/$defs/SubdivisionTypeEnum"
            }
          ],
          "minimum": -2147483648,
          "maximum": 2147483647
        },
        "country": {
          "type": "integer"
        },
        "parent": {
          "type": [
            "integer",
            "null"
          ]
        }
      },
      "required": [
        "childSubdivisions",
        "country",
        "createdAt",
        "id",
        "name",
        "subdivisionType",
        "updatedAt",
        "uuid"
      ]
    },
    "SubdivisionTypeEnum": {
      "enum": [
        1,
        2,
        3,
        4,
        5
      ],
      "type": "integer"
    }
  }
}