{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://ordinis.nstart.cloud/schemas/cuod/country/1.0.0",
  "title": "Country (страны-операторы КА)",
  "description": "ISO 3166-1: код страны (alpha-2 / alpha-3 / numeric) + локализованное наименование. Используется как FK из spacecraft.country, operator.country и подобных.",
  "type": "object",
  "required": ["code", "iso_alpha3", "iso_numeric", "name", "status"],
  "additionalProperties": false,
  "x-id-source": "code",
  "properties": {
    "code": {
      "type": "string",
      "description": "ISO 3166-1 alpha-2 (RU, US, CN, EU условно).",
      "pattern": "^[A-Z]{2}$",
      "x-unique": true
    },
    "iso_alpha3": {
      "type": "string",
      "description": "ISO 3166-1 alpha-3 (RUS, USA, CHN).",
      "pattern": "^[A-Z]{3}$"
    },
    "iso_numeric": {
      "type": "integer",
      "description": "ISO 3166-1 numeric.",
      "minimum": 1,
      "maximum": 999
    },
    "name": {
      "type": "object",
      "x-localized": true,
      "patternProperties": {
        "^[a-z]{2}-[A-Z]{2}$": { "type": "string", "minLength": 1 }
      },
      "required": ["ru-RU"]
    },
    "status": {
      "type": "string",
      "enum": ["active", "archived"]
    }
  }
}
