{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "state_coordinates.schema.json",
  "title": "State Coordinates in B_vec",
  "description": "Coordinates of a sovereign state in B_viz (2D) and B_score (6D), with confidence intervals and source provenance.",
  "type": "object",
  "required": ["iso3", "x_viz", "x_score", "affinity_vector", "data_quality"],
  "properties": {
    "iso3": { "type": "string", "minLength": 3, "maxLength": 3 },
    "iso2": { "type": "string", "minLength": 2, "maxLength": 2 },
    "label": { "type": ["string", "null"] },
    "x_viz": {
      "type": "array",
      "minItems": 2,
      "maxItems": 2,
      "items": { "type": ["number", "null"] }
    },
    "x_viz_ellipse": {
      "type": "object",
      "properties": {
        "sigma": {
          "type": "array",
          "minItems": 2,
          "maxItems": 2,
          "items": {
            "type": "array",
            "minItems": 2,
            "maxItems": 2,
            "items": { "type": "number" }
          }
        },
        "confidence_level": { "type": "number", "minimum": 0, "maximum": 1 }
      }
    },
    "x_score": {
      "type": "array",
      "minItems": 6,
      "maxItems": 6,
      "items": { "type": ["number", "null"] }
    },
    "affinity_vector": {
      "type": "object",
      "description": "Derived simplex weights over the 11 macro-civilizations (softmax inverse-distance in B_score).",
      "additionalProperties": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      }
    },
    "data_quality": {
      "type": "object",
      "required": ["iw_coverage", "hofstede_coverage", "low_evidence", "x_viz_provenance", "x_score_provenance"],
      "properties": {
        "iw_coverage": { "type": "string", "enum": ["present", "imputed", "missing"] },
        "hofstede_coverage": { "type": "string", "enum": ["present", "imputed", "missing"] },
        "low_evidence": { "type": "boolean" },
        "x_viz_provenance": {
          "type": "string",
          "enum": ["observed", "imputed_wvs_items", "imputed_pew", "centroid_prior", "unresolved"],
          "description": "Tier of the imputation cascade that produced x_viz. See docs/16_imputation_cascade.md."
        },
        "x_score_provenance": {
          "type": "string",
          "enum": ["observed", "observed_with_dim_imputation", "imputed_governance", "centroid_prior", "unresolved"],
          "description": "Tier of the imputation cascade that produced x_score."
        },
        "x_score_sigma_prior": {
          "type": ["array", "null"],
          "description": "Per-dimension standard deviation propagated when x_score is imputed; null for observed states.",
          "items": { "type": "number" }
        },
        "fallback_civilization_id": {
          "type": ["string", "null"],
          "description": "Civilization whose centroid was consulted by the cascade (curated_civilization or first competing for ambiguous states)."
        },
        "pew_to_iw_model": {
          "type": "object",
          "description": "Pew → IW calibration metadata (training set size, leave-one-out RMSE per axis)."
        },
        "governance_to_hofstede_model": {
          "type": "object",
          "description": "WGI+FSI → Hofstede calibration metadata (training set size, leave-one-out RMSE per dimension)."
        },
        "notes": { "type": "string" }
      }
    },
    "source_refs": {
      "type": "array",
      "items": { "type": "string" }
    },
    "curated_civilization": {
      "type": ["string", "null"],
      "description": "Civilisation curatée depuis la taxonomie (rôles core/periphery uniquement). Null si l'état n'est listé qu'en interface/ambiguous, ou absent de la taxonomie."
    },
    "curated_role": {
      "type": ["string", "null"],
      "enum": [null, "core", "periphery", "interface", "ambiguous"]
    },
    "curated_civilizations_competing": {
      "type": ["array", "null"],
      "items": { "type": "string" },
      "description": "Civilisations en compétition pour les états en interface/ambiguous (taxonomie member_states ou ambiguous_cases)."
    },
    "sub_cluster_id": {
      "type": ["string", "null"],
      "description": "Identifiant du sous-ensemble civilisationnel (anglo, catholic_europe, arab_islamic, ...) si listé dans la taxonomie."
    },
    "sub_cluster_label": {
      "type": ["string", "null"]
    }
  },
  "additionalProperties": false
}
