{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/almanac-ar/json-schema/almanac-ar-report-result-schema.json",
  "title": "ReportResult",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/almanac-ar-v1-openapi.json#/components/schemas/ReportResult",
  "type": "object",
  "properties": {
    "cuit": {
      "type": "string"
    },
    "sections": {
      "type": "object",
      "properties": {
        "identidad": {
          "$ref": "#/$defs/ReportSection"
        },
        "crediticio": {
          "$ref": "#/$defs/ReportSection"
        },
        "cheques": {
          "$ref": "#/$defs/ReportSection"
        },
        "screening": {
          "$ref": "#/$defs/ReportSection"
        },
        "comex": {
          "$ref": "#/$defs/ReportSection"
        },
        "riesgoFiscal": {
          "$ref": "#/$defs/ReportSection"
        },
        "marcas": {
          "$ref": "#/$defs/ReportSection"
        },
        "concursos": {
          "$ref": "#/$defs/ReportSection"
        }
      }
    },
    "status": {
      "$ref": "#/$defs/ReportStatus"
    },
    "generated_at": {
      "type": "string"
    }
  },
  "required": [
    "cuit",
    "sections",
    "status",
    "generated_at"
  ],
  "additionalProperties": false,
  "$defs": {
    "ReportSection": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string"
        },
        "fields": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ReportSectionField"
          }
        },
        "source": {
          "type": "string"
        },
        "snapshot_date": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "ok",
            "parcial",
            "no_disponible"
          ]
        },
        "error_reason": {
          "type": "string"
        }
      },
      "required": [
        "title",
        "fields",
        "source",
        "snapshot_date",
        "status"
      ],
      "additionalProperties": {
        "nullable": true
      },
      "description": "Sección normalizada del informe. Además de los campos listados, algunas secciones traen un bloque propio: 'crediticio' → `entidades[]`, 'comex' → `comex`, 'riesgoFiscal' → `riesgoFiscal`, 'marcas' → `marcas[]`, 'concursos' → `concursos[]`. Ver NormalizedSection en lib/informes/types.ts (repo) para el detalle completo de cada bloque."
    },
    "ReportSectionField": {
      "type": "object",
      "properties": {
        "label": {
          "type": "string"
        },
        "value": {
          "type": [
            "string",
            "null"
          ]
        },
        "fuente_dataset_id": {
          "type": "string"
        },
        "snapshot_date": {
          "type": "string"
        }
      },
      "required": [
        "label",
        "value",
        "fuente_dataset_id",
        "snapshot_date"
      ],
      "additionalProperties": false
    },
    "ReportStatus": {
      "type": "string",
      "enum": [
        "ok",
        "parcial",
        "no_resuelto"
      ],
      "description": "'ok': todas las secciones resolvieron con dato real. 'parcial': al menos una sección tiene dato real, pero no todas. 'no_resuelto': ninguna fuente entregó nada — no se cobra."
    }
  }
}