{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/balancos-ai/json-schema/balancos-ai-apps-api-bcb-modelos-envelope-ranking-schema.json",
  "title": "EnvelopeRanking",
  "x-generated": "2026-11-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/balancos-ai-openapi.json#/components/schemas/apps__api__bcb__modelos__EnvelopeRanking",
  "properties": {
    "dados": {
      "$ref": "#/$defs/apps__api__bcb__modelos__Ranking"
    },
    "meta": {
      "$ref": "#/$defs/Meta"
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "dados",
    "meta"
  ],
  "$defs": {
    "Codigo": {
      "properties": {
        "codigo": {
          "type": "string",
          "title": "Codigo"
        },
        "nome": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Nome"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "codigo",
        "nome"
      ],
      "title": "Codigo"
    },
    "EmpresaResumo": {
      "properties": {
        "razao_social": {
          "type": "string",
          "title": "Razao Social"
        },
        "slug": {
          "type": "string",
          "title": "Slug"
        },
        "link": {
          "type": "string",
          "title": "Link"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "razao_social",
        "slug",
        "link"
      ],
      "title": "EmpresaResumo",
      "description": "`{razao_social, slug, link}` — o ponteiro leve usado dentro de\nbalanços, DREs e documentos."
    },
    "InstituicaoRanking": {
      "properties": {
        "posicao": {
          "type": "integer",
          "title": "Posicao"
        },
        "nivel": {
          "type": "string",
          "title": "Nivel"
        },
        "codinst": {
          "type": "string",
          "title": "Codinst"
        },
        "nome": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Nome"
        },
        "cnpj": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Cnpj"
        },
        "tipo": {
          "anyOf": [
            {
              "$ref": "#/$defs/Codigo"
            },
            {
              "type": "null"
            }
          ]
        },
        "consolidado_bancario": {
          "anyOf": [
            {
              "$ref": "#/$defs/Codigo"
            },
            {
              "type": "null"
            }
          ]
        },
        "uf": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Uf"
        },
        "valor": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Valor"
        },
        "empresa": {
          "anyOf": [
            {
              "$ref": "#/$defs/EmpresaResumo"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "posicao",
        "nivel",
        "codinst",
        "nome",
        "cnpj",
        "tipo",
        "consolidado_bancario",
        "uf",
        "valor",
        "empresa"
      ],
      "title": "InstituicaoRanking"
    },
    "Meta": {
      "properties": {
        "versao": {
          "type": "string",
          "title": "Versao",
          "default": "v1"
        },
        "release": {
          "type": "string",
          "title": "Release",
          "default": "1.3.0"
        },
        "dados_atualizados_em": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Dados Atualizados Em"
        },
        "requisicao_id": {
          "type": "string",
          "title": "Requisicao Id"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "dados_atualizados_em",
        "requisicao_id"
      ],
      "title": "Meta"
    },
    "apps__api__bcb__modelos__Ranking": {
      "properties": {
        "data_base": {
          "type": "string",
          "title": "Data Base"
        },
        "data_referencia": {
          "type": "string",
          "title": "Data Referencia"
        },
        "nivel": {
          "type": "string",
          "title": "Nivel"
        },
        "metrica": {
          "type": "string",
          "title": "Metrica"
        },
        "unidade": {
          "type": "string",
          "title": "Unidade"
        },
        "inicio": {
          "type": "integer",
          "title": "Inicio"
        },
        "total": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Total"
        },
        "proximo_inicio": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Proximo Inicio"
        },
        "instituicoes": {
          "items": {
            "$ref": "#/$defs/InstituicaoRanking"
          },
          "type": "array",
          "title": "Instituicoes"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "data_base",
        "data_referencia",
        "nivel",
        "metrica",
        "unidade",
        "inicio",
        "total",
        "proximo_inicio",
        "instituicoes"
      ],
      "title": "Ranking"
    }
  }
}