{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/alfil-co/json-schema/alfil-co-finanzas-response-schema.json",
  "title": "FinanzasResponse",
  "description": "Finanzas territoriales (CUIPO/DNP)",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/alfil-co-finanzas-api-openapi.yml#/components/schemas/FinanzasResponse",
  "type": "object",
  "properties": {
    "data": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/FinanzaTerritorial"
      }
    },
    "page": {
      "$ref": "#/$defs/Page"
    },
    "fuente": {
      "$ref": "#/$defs/Fuente"
    }
  },
  "required": [
    "data",
    "page",
    "fuente"
  ],
  "additionalProperties": false,
  "$defs": {
    "FinanzaTerritorial": {
      "type": "object",
      "properties": {
        "entidad": {
          "type": "string"
        },
        "anio": {
          "type": "number"
        },
        "presupuesto_cop": {
          "type": "string",
          "description": "Presupuesto en COP (bigint como string)"
        },
        "ejecutado_cop": {
          "type": "string",
          "description": "Ejecutado en COP (bigint como string)"
        }
      },
      "required": [
        "entidad",
        "anio",
        "presupuesto_cop",
        "ejecutado_cop"
      ],
      "additionalProperties": false
    },
    "Fuente": {
      "type": "object",
      "properties": {
        "nombre": {
          "type": "string",
          "description": "Fuente oficial del dato"
        },
        "url": {
          "description": "URL de la fuente oficial",
          "type": "string"
        },
        "corte": {
          "type": "string",
          "description": "Fecha de corte del dato (ISO 8601)"
        },
        "licencia": {
          "description": "Licencia de la fuente",
          "type": "string"
        }
      },
      "required": [
        "nombre",
        "corte"
      ],
      "additionalProperties": false,
      "description": "Proveniencia: fuente oficial y fecha de corte (atribución Ley 1712)"
    },
    "Page": {
      "type": "object",
      "properties": {
        "cursor": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "Cursor opaco de la siguiente página; null si no hay más"
        },
        "has_more": {
          "type": "boolean",
          "description": "Indica si existen más resultados"
        }
      },
      "required": [
        "cursor",
        "has_more"
      ],
      "additionalProperties": false,
      "description": "Paginación por cursor opaco (no offset)"
    }
  }
}