{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://observatorioia.org/api/schemas/indicadores.schema.json",
  "title": "Indicadores / Indicators",
  "description": "Schema de la respuesta pública completa; el campo data también se publica por separado. / Full public-response schema; the data field schema is also published separately.",
  "type": "object",
  "required": [
    "version",
    "lastUpdate",
    "count",
    "source",
    "license",
    "data"
  ],
  "additionalProperties": false,
  "properties": {
    "version": {
      "type": "string",
      "minLength": 1
    },
    "lastUpdate": {
      "type": "string",
      "format": "date-time"
    },
    "count": {
      "type": "integer",
      "minimum": 0
    },
    "source": {
      "const": "https://observatorioia.org"
    },
    "license": {
      "const": "CC BY 4.0"
    },
    "data": {
      "$ref": "#/definitions/_dataset"
    }
  },
  "definitions": {
    "bilingual": {
      "type": "object",
      "required": [
        "es",
        "en"
      ],
      "additionalProperties": false,
      "properties": {
        "es": {
          "type": "string",
          "minLength": 1
        },
        "en": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "fuente": {
      "type": "object",
      "required": [
        "url",
        "descripcion"
      ],
      "additionalProperties": false,
      "properties": {
        "url": {
          "type": "string",
          "format": "uri"
        },
        "descripcion": {
          "$ref": "#/definitions/bilingual"
        },
        "nombre": {
          "$ref": "#/definitions/bilingual"
        }
      }
    },
    "oecdIndex": {
      "type": "object",
      "required": [
        "ranking",
        "subdimensionesCostaRica",
        "crVsAnterior",
        "fuentes"
      ],
      "additionalProperties": false,
      "properties": {
        "ranking": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "required": [
              "pais",
              "score"
            ],
            "additionalProperties": false,
            "properties": {
              "pais": {
                "$ref": "#/definitions/bilingual"
              },
              "score": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "destacado": {
                "type": "boolean"
              },
              "esPromedio": {
                "type": "boolean"
              }
            }
          }
        },
        "subdimensionesCostaRica": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "required": [
              "nombre",
              "score"
            ],
            "additionalProperties": false,
            "properties": {
              "nombre": {
                "$ref": "#/definitions/bilingual"
              },
              "score": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            }
          }
        },
        "crVsAnterior": {
          "type": "object",
          "required": [
            "score2023",
            "score2025",
            "delta"
          ],
          "additionalProperties": false,
          "properties": {
            "score2023": {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            },
            "score2025": {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            },
            "delta": {
              "type": "number"
            }
          }
        },
        "fuentes": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/definitions/fuente"
          }
        }
      }
    },
    "_dataset": {
      "type": "object",
      "required": [
        "ilia2025",
        "comparativaRegional",
        "kpisHero",
        "dgi2025",
        "ourdata2025"
      ],
      "additionalProperties": false,
      "properties": {
        "ilia2025": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "pais",
              "ilia",
              "edicion",
              "fuenteUrl"
            ],
            "additionalProperties": false,
            "properties": {
              "pais": {
                "$ref": "#/definitions/bilingual"
              },
              "ilia": {
                "type": "number",
                "minimum": 0,
                "maximum": 100
              },
              "edicion": {
                "type": "integer",
                "minimum": 2023
              },
              "fuenteUrl": {
                "type": "string",
                "format": "uri"
              },
              "destacado": {
                "type": "boolean"
              }
            }
          }
        },
        "comparativaRegional": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "pais",
              "ilia",
              "iliaEdicion",
              "iliaFuenteUrl",
              "inversion",
              "enteEjecutor",
              "hito",
              "fuentes"
            ],
            "additionalProperties": false,
            "properties": {
              "pais": {
                "$ref": "#/definitions/bilingual"
              },
              "ilia": {
                "type": "number",
                "minimum": 0,
                "maximum": 100
              },
              "iliaEdicion": {
                "type": "integer",
                "minimum": 2023
              },
              "iliaFuenteUrl": {
                "type": "string",
                "format": "uri"
              },
              "inversion": {
                "$ref": "#/definitions/bilingual"
              },
              "enteEjecutor": {
                "$ref": "#/definitions/bilingual"
              },
              "hito": {
                "$ref": "#/definitions/bilingual"
              },
              "fuentes": {
                "type": "array",
                "minItems": 1,
                "items": {
                  "$ref": "#/definitions/fuente"
                }
              },
              "destacado": {
                "type": "boolean"
              }
            }
          }
        },
        "kpisHero": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "label",
              "valor",
              "detalle"
            ],
            "additionalProperties": false,
            "properties": {
              "label": {
                "$ref": "#/definitions/bilingual"
              },
              "valor": {
                "type": "string",
                "minLength": 1
              },
              "detalle": {
                "$ref": "#/definitions/bilingual"
              }
            }
          }
        },
        "dgi2025": {
          "$ref": "#/definitions/oecdIndex"
        },
        "ourdata2025": {
          "$ref": "#/definitions/oecdIndex"
        }
      }
    }
  },
  "x-observatorio-data-schema": "/api/schemas/indicadores-data.schema.json"
}