{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/alfil-co/json-schema/alfil-co-contrato-adiciones-response-schema.json",
  "title": "ContratoAdicionesResponse",
  "description": "Adiciones (modificaciones de valor) de un contrato SECOP II",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/alfil-co-openapi.json#/components/schemas/ContratoAdicionesResponse",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "adiciones": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "estado_fuente": {
              "type": "string",
              "const": "no_consultado"
            },
            "registros": {
              "type": "null"
            },
            "truncado": {
              "type": "null"
            },
            "corte": {
              "type": "null"
            },
            "consultado_en": {
              "type": "string"
            }
          },
          "required": [
            "estado_fuente",
            "registros",
            "truncado",
            "corte",
            "consultado_en"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "estado_fuente": {
              "type": "string",
              "const": "ok"
            },
            "registros": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/Adicion"
              }
            },
            "truncado": {
              "type": "boolean",
              "description": "Si la lista alcanzó el límite de la consulta (posiblemente incompleta)"
            },
            "corte": {
              "type": "string"
            },
            "consultado_en": {
              "type": "string"
            }
          },
          "required": [
            "estado_fuente",
            "registros",
            "truncado",
            "corte",
            "consultado_en"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "estado_fuente": {
              "type": "string",
              "const": "error"
            },
            "registros": {
              "type": "null"
            },
            "truncado": {
              "type": "null"
            },
            "corte": {
              "type": "null"
            },
            "consultado_en": {
              "type": "string"
            }
          },
          "required": [
            "estado_fuente",
            "registros",
            "truncado",
            "corte",
            "consultado_en"
          ],
          "additionalProperties": false
        }
      ],
      "type": "object"
    }
  },
  "required": [
    "id",
    "adiciones"
  ],
  "additionalProperties": false,
  "$defs": {
    "Adicion": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "tipo": {
          "type": "string"
        },
        "descripcion": {
          "type": "string",
          "description": "Texto libre de la fuente; cualquier valor monetario de la adición vive acá, sin parsear"
        },
        "fecha_registro": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "tipo",
        "descripcion",
        "fecha_registro"
      ],
      "additionalProperties": false,
      "description": "Adición (modificación de valor) de un contrato SECOP II"
    }
  }
}