{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://atalaya.networksols.com.co/api/v1/esquema.json",
  "title": "API v1 de Atalaya",
  "description": "Esquema del índice y del detalle de entidades. Nota calculada con el método v2.",
  "version": "1.0.0",
  "generado": "2026-11-25",
  "metodo": {
    "version": "v2",
    "formula": "nota = round(100 * min(1, avance_esperado) * confianza)",
    "avance_esperado": {
      "dorado": 1.0,
      "verde": 0.8,
      "ambar": 0.5,
      "rojo": 0.15,
      "gris": 0.2
    },
    "pesos_fuente": {
      "oficial": 1.0,
      "medio_nacional": 0.75,
      "otro_medio": 0.55,
      "redes_o_asistente": 0.35
    },
    "tope_confianza": 1.0,
    "penalizacion_menos_de_dos_fuentes": 0.8,
    "bandas": {
      "Cumple y supera": ">= 85",
      "Avance alto": ">= 70",
      "Avance parcial": ">= 45",
      "Rezago": ">= 20",
      "Sin evidencia": ">= 0"
    }
  },
  "rutas": {
    "indice": {
      "ruta": "/api/v1/entidades.json",
      "metodo": "GET"
    },
    "detalle": {
      "ruta": "/api/v1/entidades/{slug}.json",
      "metodo": "GET"
    }
  },
  "entidad": {
    "type": "object",
    "required": [
      "slug",
      "nota",
      "logro",
      "confianza",
      "banda",
      "evidencia",
      "historial",
      "fuentes"
    ],
    "properties": {
      "slug": {
        "type": "string",
        "pattern": "^[a-z0-9-]+$"
      },
      "nota": {
        "type": "integer",
        "minimum": 0,
        "maximum": 100
      },
      "logro": {
        "type": "integer",
        "minimum": 0,
        "maximum": 100,
        "description": "Avance esperado en puntos; fija la banda sin descontar confianza."
      },
      "confianza": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      },
      "banda": {
        "type": "string",
        "enum": [
          "dorado",
          "verde",
          "ambar",
          "rojo",
          "sin"
        ]
      },
      "evidencia": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "dominio": {
              "type": "string"
            },
            "fuerza": {
              "type": "number"
            },
            "fuerza_etiqueta": {
              "type": "string"
            },
            "url": {
              "type": "string"
            }
          }
        }
      },
      "historial": {
        "type": "array",
        "minItems": 3,
        "maxItems": 3,
        "items": {
          "type": "object",
          "properties": {
            "corte": {
              "type": "string",
              "format": "date"
            },
            "nota": {
              "type": "integer"
            },
            "banda": {
              "type": "string"
            }
          }
        }
      },
      "fuentes": {
        "type": "array",
        "items": {
          "type": "string",
          "format": "uri"
        }
      },
      "vacante": {
        "type": [
          "object",
          "null"
        ]
      }
    }
  }
}
