{
  "openapi": "3.0.0",
  "paths": {
    "/v1/research-requests": {
      "post": {
        "description": "Inicia uma nova consulta de dados processuais e retorna o identificador da requisição.",
        "operationId": "ResearchRequestsController_create",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateResearch"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Consulta aceita.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResearchAccepted"
                }
              }
            }
          },
          "400": {
            "description": "CNJ inválido ou tribunal não suportado."
          },
          "401": {
            "description": "Credencial inválida."
          },
          "403": {
            "description": "Cliente sem acesso vigente."
          },
          "429": {
            "description": "Limite de requisições excedido."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Criar consulta",
        "tags": [
          "Pesquisa"
        ]
      }
    },
    "/v1/research-requests/{requestId}": {
      "get": {
        "description": "Retorna o estado atual e, quando disponível, os dados da consulta.",
        "operationId": "ResearchRequestsController_get",
        "parameters": [
          {
            "name": "requestId",
            "required": true,
            "in": "path",
            "description": "Identificador retornado na criação.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Estado da pesquisa. SUCCESS inclui os dados; falhas de coleta também retornam HTTP 200 com status próprio.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResearchResult"
                },
                "examples": {
                  "success": {
                    "summary": "Sucesso — processo encontrado (dados sintéticos)",
                    "value": {
                      "requestId": "11111111-1111-4111-8111-111111111111",
                      "status": "SUCCESS",
                      "resultStatus": "FOUND",
                      "dataAvailable": true,
                      "createdAt": "2026-10-15T10:00:00.000-03:00",
                      "data": {
                        "cnj": "0054874-11.2021.1.00.0000",
                        "cases": [
                          {
                            "cnj": "0054874-11.2021.1.00.0000",
                            "court": "STF",
                            "courtName": "Supremo Tribunal Federal",
                            "instance": "1",
                            "caseClass": "Classe processual de exemplo",
                            "mainSubject": "Assunto de exemplo",
                            "classes": [
                              {
                                "code": "999",
                                "description": "Classe processual de exemplo",
                                "hierarchy": []
                              }
                            ],
                            "subjects": [
                              {
                                "code": "999",
                                "description": "Assunto de exemplo",
                                "hierarchy": [],
                                "secondary": false
                              }
                            ],
                            "parties": [
                              {
                                "name": "Parte fictícia A",
                                "polarity": "ACTIVE",
                                "role": "REQUERENTE",
                                "identifications": [],
                                "aliases": [],
                                "representatives": []
                              },
                              {
                                "name": "Parte fictícia B",
                                "polarity": "PASSIVE",
                                "role": "REQUERIDO",
                                "identifications": [],
                                "aliases": [],
                                "representatives": []
                              }
                            ],
                            "movements": [
                              {
                                "occurredAt": "2026-10-14T14:30:00.000-03:00",
                                "rawOccurredAt": "2026-10-14T17:30:00Z",
                                "description": "Juntada de petição de exemplo",
                                "attachmentIndexes": []
                              }
                            ],
                            "attachments": [
                              {
                                "attachmentId": "22222222-2222-4222-8222-222222222222",
                                "name": "Petição de exemplo.pdf",
                                "filedAt": "2026-10-14T14:30:00.000-03:00"
                              }
                            ],
                            "relatedLawsuits": []
                          }
                        ]
                      }
                    }
                  },
                  "queued": {
                    "summary": "Aguardando processamento",
                    "value": {
                      "requestId": "11111111-1111-4111-8111-111111111111",
                      "status": "QUEUED"
                    }
                  },
                  "processing": {
                    "summary": "Em processamento",
                    "value": {
                      "requestId": "11111111-1111-4111-8111-111111111111",
                      "status": "PROCESSING"
                    }
                  },
                  "noData": {
                    "summary": "Processo não encontrado",
                    "value": {
                      "requestId": "11111111-1111-4111-8111-111111111111",
                      "status": "NO_DATA",
                      "resultStatus": "NOT_FOUND",
                      "data": {
                        "cnj": "0054874-11.2021.1.00.0000",
                        "cases": []
                      },
                      "error": {
                        "code": "PROCESS_NOT_FOUND",
                        "message": "Processo não encontrado."
                      }
                    }
                  },
                  "failed": {
                    "summary": "Falha na pesquisa",
                    "value": {
                      "requestId": "11111111-1111-4111-8111-111111111111",
                      "status": "FAILED",
                      "error": {
                        "code": "RESEARCH_FAILED",
                        "message": "Não foi possível concluir a pesquisa judicial."
                      }
                    }
                  },
                  "expired": {
                    "summary": "Resultado expirado",
                    "value": {
                      "requestId": "11111111-1111-4111-8111-111111111111",
                      "status": "EXPIRED",
                      "resultStatus": "FOUND",
                      "dataAvailable": false,
                      "message": "Os dados desta consulta expiraram e não estão mais disponíveis. Crie uma nova pesquisa informando o CNJ em POST /v1/research-requests.",
                      "error": {
                        "code": "RESEARCH_RESULT_EXPIRED",
                        "message": "Os dados desta consulta expiraram e não estão mais disponíveis. Crie uma nova pesquisa informando o CNJ em POST /v1/research-requests."
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Credencial ausente ou inválida."
          },
          "403": {
            "description": "Acesso não autorizado."
          },
          "404": {
            "description": "Consulta não encontrada para o cliente."
          },
          "429": {
            "description": "Limite de requisições excedido."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Consultar resultado da pesquisa",
        "tags": [
          "Pesquisa"
        ]
      }
    },
    "/v1/attachment-requests": {
      "post": {
        "description": "Informe requestId e attachmentId retornado na listagem da instância. Agenda somente esse arquivo, sem aguardar coleta. Acompanhe pelo GET de anexos ou webhook. Repetir o mesmo pedido não reinicia tentativas ou validade.",
        "operationId": "AttachmentsController_request",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RequestResearchAttachments"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Solicitação aceita; não indica conclusão da coleta.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResearchAttachmentsAccepted"
                }
              }
            }
          },
          "400": {
            "description": "Informe requestId como UUID no body."
          },
          "404": {
            "description": "Pesquisa inexistente ou de outro cliente."
          },
          "409": {
            "description": "NO_DATA/FAILED: sem dados para obter anexos, com status e mensagem orientando nova pesquisa pelo CNJ. Também recusa pesquisa ainda em processamento ou anterior ao suporte a anexos.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResearchAttachmentsRejected"
                },
                "examples": {
                  "noData": {
                    "summary": "Pesquisa sem dados",
                    "value": {
                      "requestId": "11111111-1111-4111-8111-111111111111",
                      "status": "NO_DATA",
                      "resultStatus": "NOT_FOUND",
                      "dataAvailable": false,
                      "message": "Não foram encontrados dados para este processo no tribunal. Não é possível solicitar anexos desta pesquisa. Crie uma nova pesquisa informando o CNJ em POST /v1/research-requests.",
                      "error": {
                        "code": "PROCESS_NOT_FOUND",
                        "message": "Não foram encontrados dados para este processo no tribunal."
                      }
                    }
                  },
                  "failed": {
                    "summary": "Pesquisa falhou",
                    "value": {
                      "requestId": "11111111-1111-4111-8111-111111111111",
                      "status": "FAILED",
                      "dataAvailable": false,
                      "message": "Não foi possível concluir a consulta dentro do prazo. Não é possível solicitar anexos desta pesquisa. Crie uma nova pesquisa informando o CNJ em POST /v1/research-requests.",
                      "error": {
                        "code": "REQUEST_TIMEOUT",
                        "message": "Não foi possível concluir a consulta dentro do prazo."
                      }
                    }
                  }
                }
              }
            }
          },
          "410": {
            "description": "Pesquisa expirada; crie nova pesquisa pelo CNJ.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResearchExpired"
                }
              }
            }
          },
          "503": {
            "description": "Obtenção de anexos suspensa ou armazenamento indisponível."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Solicitar um anexo da pesquisa",
        "tags": [
          "Pesquisa"
        ]
      }
    },
    "/v1/attachment-requests/{requestId}/{attachmentId}": {
      "get": {
        "description": "GET não concede autorização nem gera upgrade. 202 contém JSON; 200 contém binário. Respeite Retry-After. HEAD observa metadados sem ler o Blob.",
        "operationId": "AttachmentsController_get",
        "parameters": [
          {
            "name": "requestId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "attachmentId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Arquivo autorizado.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "202": {
            "description": "Pedido em processamento; repetir este GET respeitando Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AttachmentPending"
                }
              }
            }
          },
          "404": {
            "description": "Recurso inexistente ou de outro cliente."
          },
          "409": {
            "description": "Anexo não solicitado ou aquisição encerrada sem arquivo."
          },
          "410": {
            "description": "Pesquisa expirada."
          },
          "429": {
            "description": "Limite compartilhado de acessos por cliente."
          },
          "503": {
            "description": "Falha temporária de armazenamento ou orçamento operacional indisponível."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Acompanhar e baixar um anexo solicitado",
        "tags": [
          "Pesquisa"
        ]
      }
    },
    "/v1/monitorings": {
      "post": {
        "description": "Cria um monitoramento para um processo e instância.",
        "operationId": "MonitoringsController_create",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateMonitoring"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MonitoringAccepted"
                }
              }
            }
          },
          "400": {
            "description": "CNJ, instância ou parâmetros inválidos."
          },
          "401": {
            "description": "Credencial ausente ou inválida."
          },
          "403": {
            "description": "Acesso não autorizado."
          },
          "409": {
            "description": "Conflito na criação do monitoramento."
          },
          "429": {
            "description": "Limite de requisições excedido."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Criar monitoramento",
        "tags": [
          "Monitoramento"
        ]
      },
      "get": {
        "description": "Retorna os monitoramentos cadastrados para o cliente.",
        "operationId": "MonitoringsController_list",
        "parameters": [
          {
            "name": "page",
            "required": false,
            "in": "query",
            "schema": {
              "example": 1,
              "type": "number"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "1 a 100.",
            "schema": {
              "example": 25,
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MonitoringListItem"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Paginação inválida."
          },
          "401": {
            "description": "Credencial ausente ou inválida."
          },
          "403": {
            "description": "Acesso não autorizado."
          },
          "429": {
            "description": "Limite de requisições excedido."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Listar monitoramentos",
        "tags": [
          "Monitoramento"
        ]
      }
    },
    "/v1/monitorings/{monitoringId}": {
      "get": {
        "description": "Retorna o estado e os dados do CNJ e instância, incluindo os anexos em case.attachments e URLs privadas DataWho dos arquivos disponíveis. Anexos são sempre incluídos no monitoramento; não existe solicitação separada. O campo url é omitido para arquivos não obtidos; antes da coleta inicial, case pode estar ausente.",
        "operationId": "MonitoringsController_get",
        "parameters": [
          {
            "name": "monitoringId",
            "required": true,
            "in": "path",
            "description": "Identificador retornado na criação.",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MonitoringResult"
                }
              }
            }
          },
          "401": {
            "description": "Credencial ausente ou inválida."
          },
          "403": {
            "description": "Acesso não autorizado."
          },
          "404": {
            "description": "Assinatura inexistente ou de outro cliente."
          },
          "429": {
            "description": "Limite de requisições excedido."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Consultar monitoramento",
        "tags": [
          "Monitoramento"
        ]
      },
      "delete": {
        "description": "Desativa o monitoramento informado para o cliente autenticado.",
        "operationId": "MonitoringsController_remove",
        "parameters": [
          {
            "name": "monitoringId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MonitoringRemoved"
                }
              }
            }
          },
          "401": {
            "description": "Credencial ausente ou inválida."
          },
          "403": {
            "description": "Acesso não autorizado."
          },
          "404": {
            "description": "Monitoramento não encontrado para o cliente."
          },
          "429": {
            "description": "Limite de requisições excedido."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Desativar monitoramento",
        "tags": [
          "Monitoramento"
        ]
      }
    },
    "/v1/monitorings/attachment-requests": {
      "post": {
        "description": "Sem tarifa adicional. Acesso individual; prazo fixo de 30 dias desde armazenamento. Repetir nao renova o prazo.",
        "operationId": "AttachmentsController_monitoringRequest",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "monitoringId",
                  "attachmentId"
                ],
                "additionalProperties": false,
                "properties": {
                  "monitoringId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "attachmentId": {
                    "type": "string",
                    "format": "uuid"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Pedido aceito; acompanhe o header Location."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Solicitar um anexo do monitoramento",
        "tags": [
          "Monitoramento"
        ]
      }
    },
    "/v1/monitorings/attachment-requests/{monitoringId}/{attachmentId}": {
      "get": {
        "description": "GET/HEAD nao adquirem nem renovam o arquivo. Cancelamento bloqueia acesso imediatamente.",
        "operationId": "AttachmentsController_monitoringGet",
        "parameters": [
          {
            "name": "monitoringId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "name": "attachmentId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Arquivo privado.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "202": {
            "description": "Em processamento; respeite Retry-After."
          },
          "404": {
            "description": "Recurso inexistente ou de outro cliente."
          },
          "409": {
            "description": "Sem pedido, monitoramento inelegivel ou arquivo indisponivel."
          },
          "410": {
            "description": "Prazo de 30 dias encerrado; novo POST necessario."
          },
          "429": {
            "description": "Limite compartilhado de acessos."
          },
          "503": {
            "description": "Falha temporaria de armazenamento."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Acompanhar e baixar anexo solicitado do monitoramento",
        "tags": [
          "Monitoramento"
        ]
      }
    },
    "/v1/monitorings/{monitoringId}/info": {
      "get": {
        "description": "Retorna informações de configuração e estado do monitoramento.",
        "operationId": "MonitoringsController_info",
        "parameters": [
          {
            "name": "monitoringId",
            "required": true,
            "in": "path",
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MonitoringInfo"
                }
              }
            }
          },
          "401": {
            "description": "Credencial ausente ou inválida."
          },
          "403": {
            "description": "Acesso não autorizado."
          },
          "404": {
            "description": "Monitoramento não encontrado para o cliente."
          },
          "429": {
            "description": "Limite de requisições excedido."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Consultar informações do monitoramento",
        "tags": [
          "Monitoramento"
        ]
      }
    },
    "/v1/monitorings/batch": {
      "delete": {
        "description": "Desativa múltiplos monitoramentos do cliente em uma única operação.",
        "operationId": "MonitoringsController_removeBatch",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MonitoringBatch"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MonitoringBatchRemoved"
                }
              }
            }
          },
          "400": {
            "description": "Informe de 1 a 100 identificadores UUID."
          },
          "401": {
            "description": "Credencial ausente ou inválida."
          },
          "403": {
            "description": "Acesso não autorizado."
          },
          "429": {
            "description": "Limite de requisições excedido."
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "summary": "Desativar monitoramentos em lote",
        "tags": [
          "Monitoramento"
        ]
      }
    },
    "/health": {
      "get": {
        "description": "Retorna o estado atual da aplicação.",
        "operationId": "HealthController_getHealth",
        "parameters": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "ok"
                      ]
                    },
                    "service": {
                      "type": "string"
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          }
        },
        "summary": "Verificar disponibilidade da API",
        "tags": [
          "Aplicação"
        ]
      }
    }
  },
  "info": {
    "title": "DataWho",
    "description": "API para acesso, consulta e monitoramento de dados estruturados de múltiplas fontes.",
    "version": "2.0",
    "contact": {}
  },
  "tags": [
    {
      "name": "Aplicação",
      "description": "Informações básicas de disponibilidade da API."
    },
    {
      "name": "Pesquisa",
      "description": "Operações para consulta de processos judiciais."
    },
    {
      "name": "Monitoramento",
      "description": "Operações para acompanhamento de processos judiciais."
    }
  ],
  "servers": [],
  "components": {
    "securitySchemes": {
      "apiKey": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "type": "http",
        "description": "Credencial do cliente DataWho."
      }
    },
    "schemas": {
      "CreateResearch": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "cnj": {
            "type": "string",
            "example": "0054874-11.2021.1.00.0000",
            "description": "CNJ com máscara ou 20 dígitos na entrada; mascarado na saída."
          }
        },
        "required": [
          "cnj"
        ]
      },
      "ResearchAccepted": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "status": {
            "type": "string",
            "enum": [
              "QUEUED"
            ]
          }
        },
        "required": [
          "requestId",
          "status",
          "createdAt"
        ]
      },
      "ResearchResult": {
        "example": {
          "requestId": "11111111-1111-4111-8111-111111111111",
          "status": "SUCCESS",
          "resultStatus": "FOUND",
          "dataAvailable": true,
          "createdAt": "2026-10-15T10:00:00.000-03:00",
          "data": {
            "cnj": "0054874-11.2021.1.00.0000",
            "cases": [
              {
                "cnj": "0054874-11.2021.1.00.0000",
                "court": "STF",
                "courtName": "Supremo Tribunal Federal",
                "instance": "1",
                "caseClass": "Classe processual de exemplo",
                "mainSubject": "Assunto de exemplo",
                "classes": [
                  {
                    "code": "999",
                    "description": "Classe processual de exemplo",
                    "hierarchy": []
                  }
                ],
                "subjects": [
                  {
                    "code": "999",
                    "description": "Assunto de exemplo",
                    "hierarchy": [],
                    "secondary": false
                  }
                ],
                "parties": [
                  {
                    "name": "Parte fictícia A",
                    "polarity": "ACTIVE",
                    "role": "REQUERENTE",
                    "identifications": [],
                    "aliases": [],
                    "representatives": []
                  },
                  {
                    "name": "Parte fictícia B",
                    "polarity": "PASSIVE",
                    "role": "REQUERIDO",
                    "identifications": [],
                    "aliases": [],
                    "representatives": []
                  }
                ],
                "movements": [
                  {
                    "occurredAt": "2026-10-14T14:30:00.000-03:00",
                    "rawOccurredAt": "2026-10-14T17:30:00Z",
                    "description": "Juntada de petição de exemplo",
                    "attachmentIndexes": []
                  }
                ],
                "attachments": [
                  {
                    "attachmentId": "22222222-2222-4222-8222-222222222222",
                    "name": "Petição de exemplo.pdf",
                    "filedAt": "2026-10-14T14:30:00.000-03:00"
                  }
                ],
                "relatedLawsuits": []
              }
            ]
          }
        },
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "requestId": {
                "type": "string",
                "format": "uuid"
              },
              "status": {
                "type": "string",
                "enum": [
                  "QUEUED"
                ],
                "description": "Consulta aguardando processamento."
              }
            },
            "required": [
              "requestId",
              "status"
            ]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "requestId": {
                "type": "string",
                "format": "uuid"
              },
              "status": {
                "type": "string",
                "enum": [
                  "PROCESSING"
                ],
                "description": "Consulta em andamento."
              }
            },
            "required": [
              "requestId",
              "status"
            ]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "requestId": {
                "type": "string",
                "format": "uuid"
              },
              "status": {
                "type": "string",
                "enum": [
                  "SUCCESS"
                ],
                "description": "Dados disponíveis."
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "nullable": true
              },
              "resultStatus": {
                "type": "string",
                "enum": [
                  "FOUND"
                ]
              },
              "dataAvailable": {
                "type": "boolean",
                "enum": [
                  true
                ]
              },
              "data": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "cnj": {
                    "type": "string",
                    "example": "0054874-11.2021.1.00.0000",
                    "description": "CNJ com máscara ou 20 dígitos na entrada; mascarado na saída."
                  },
                  "cases": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/JudicialCase"
                    }
                  }
                },
                "required": [
                  "cnj",
                  "cases"
                ]
              }
            },
            "required": [
              "requestId",
              "status",
              "resultStatus",
              "data",
              "dataAvailable"
            ]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "requestId": {
                "type": "string",
                "format": "uuid"
              },
              "status": {
                "type": "string",
                "enum": [
                  "NO_DATA"
                ],
                "description": "Nenhum registro encontrado."
              },
              "resultStatus": {
                "type": "string",
                "enum": [
                  "NOT_FOUND"
                ]
              },
              "data": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "cnj": {
                    "type": "string",
                    "example": "0054874-11.2021.1.00.0000",
                    "description": "CNJ com máscara ou 20 dígitos na entrada; mascarado na saída."
                  },
                  "cases": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/JudicialCase"
                    }
                  }
                },
                "required": [
                  "cnj",
                  "cases"
                ]
              },
              "error": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "code": {
                    "type": "string",
                    "enum": [
                      "RESEARCH_FAILED",
                      "TRIBUNAL_UNAVAILABLE",
                      "PROCESS_NOT_FOUND",
                      "REQUEST_TIMEOUT",
                      "RESEARCH_RESULT_EXPIRED"
                    ]
                  },
                  "message": {
                    "type": "string",
                    "description": "Descrição do erro para o consumidor."
                  }
                },
                "required": [
                  "code",
                  "message"
                ]
              }
            },
            "required": [
              "requestId",
              "status",
              "resultStatus",
              "data",
              "error"
            ]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "requestId": {
                "type": "string",
                "format": "uuid"
              },
              "status": {
                "type": "string",
                "enum": [
                  "FAILED"
                ],
                "description": "Não foi possível concluir a consulta."
              },
              "error": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "code": {
                    "type": "string",
                    "enum": [
                      "RESEARCH_FAILED",
                      "TRIBUNAL_UNAVAILABLE",
                      "PROCESS_NOT_FOUND",
                      "REQUEST_TIMEOUT",
                      "RESEARCH_RESULT_EXPIRED"
                    ]
                  },
                  "message": {
                    "type": "string",
                    "description": "Descrição do erro para o consumidor."
                  }
                },
                "required": [
                  "code",
                  "message"
                ]
              }
            },
            "required": [
              "requestId",
              "status",
              "error"
            ]
          },
          {
            "$ref": "#/components/schemas/ResearchExpired"
          }
        ]
      },
      "JudicialCase": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "cnj": {
            "type": "string",
            "example": "0054874-11.2021.1.00.0000",
            "description": "CNJ com máscara ou 20 dígitos na entrada; mascarado na saída."
          },
          "court": {
            "type": "string",
            "nullable": true
          },
          "courtName": {
            "type": "string",
            "nullable": true
          },
          "instance": {
            "type": "string",
            "enum": [
              "1",
              "2",
              "3",
              "4"
            ],
            "nullable": true
          },
          "courtType": {
            "type": "string",
            "nullable": true
          },
          "caseClass": {
            "type": "string",
            "nullable": true
          },
          "mainSubject": {
            "type": "string",
            "nullable": true
          },
          "otherSubjects": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "statusSource": {
            "type": "string",
            "nullable": true
          },
          "caseValue": {
            "type": "number",
            "nullable": true
          },
          "jurisdiction": {
            "type": "string",
            "nullable": true
          },
          "judgingBody": {
            "type": "string",
            "nullable": true
          },
          "judge": {
            "type": "string",
            "nullable": true
          },
          "distributionDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "redistributionDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "publicationDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "noticeDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "lastMovementDate": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "captureDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lastUpdate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "relatedLawsuits": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "cnj": {
                  "type": "string",
                  "example": "0054874-11.2021.1.00.0000",
                  "description": "CNJ com máscara ou 20 dígitos na entrada; mascarado na saída."
                },
                "relationType": {
                  "type": "string",
                  "nullable": true
                },
                "classCode": {
                  "type": "string",
                  "nullable": true
                },
                "caseClass": {
                  "type": "string",
                  "nullable": true
                },
                "active": {
                  "type": "boolean",
                  "nullable": true
                },
                "rawDeletedAt": {
                  "type": "string",
                  "nullable": true
                }
              }
            }
          },
          "classes": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "code": {
                  "type": "string",
                  "nullable": true
                },
                "description": {
                  "type": "string",
                  "nullable": true
                },
                "hierarchy": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  ],
                  "nullable": true
                },
                "activePoleLabel": {
                  "type": "string",
                  "nullable": true
                },
                "passivePoleLabel": {
                  "type": "string",
                  "nullable": true
                }
              }
            }
          },
          "subjects": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "code": {
                  "type": "string",
                  "nullable": true
                },
                "description": {
                  "type": "string",
                  "nullable": true
                },
                "hierarchy": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  ],
                  "nullable": true
                },
                "secondary": {
                  "oneOf": [
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "string"
                    }
                  ],
                  "nullable": true
                }
              }
            }
          },
          "parties": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "name": {
                  "type": "string",
                  "nullable": true
                },
                "polarity": {
                  "type": "string",
                  "enum": [
                    "ACTIVE",
                    "PASSIVE",
                    "NEUTRAL"
                  ]
                },
                "role": {
                  "type": "string",
                  "nullable": true
                },
                "identifications": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "type": {
                        "type": "string",
                        "nullable": true
                      },
                      "number": {
                        "type": "string",
                        "nullable": true
                      }
                    }
                  }
                },
                "aliases": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "representatives": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "name": {
                        "type": "string",
                        "nullable": true
                      },
                      "role": {
                        "type": "string",
                        "nullable": true
                      },
                      "identifications": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "type": {
                              "type": "string",
                              "nullable": true
                            },
                            "number": {
                              "type": "string",
                              "nullable": true
                            }
                          }
                        }
                      },
                      "barRegistrations": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "number": {
                              "type": "string",
                              "nullable": true
                            },
                            "state": {
                              "type": "string",
                              "nullable": true
                            },
                            "type": {
                              "type": "string",
                              "nullable": true
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "movements": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "occurredAt": {
                  "type": "string",
                  "format": "date-time",
                  "nullable": true
                },
                "rawOccurredAt": {
                  "type": "string",
                  "nullable": true,
                  "description": "Original preservado; pode não ter timezone."
                },
                "description": {
                  "type": "string",
                  "nullable": true
                },
                "title": {
                  "type": "string",
                  "nullable": true
                },
                "sequence": {
                  "type": "string",
                  "nullable": true
                },
                "attachmentIndexes": {
                  "type": "array",
                  "items": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Índice do anexo associado em attachments[] deste processo."
                  }
                }
              }
            }
          },
          "attachments": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "attachmentId": {
                  "type": "string",
                  "format": "uuid",
                  "description": "Identificador DataWho do anexo desta pesquisa/instância; informe-o na solicitação individual. Não é um identificador do fornecedor."
                },
                "name": {
                  "type": "string"
                },
                "url": {
                  "type": "string",
                  "description": "Link privado DataWho, presente somente quando esse arquivo foi solicitado e está disponível. Ausência também pode indicar restrição ou falha; acompanhe o estado da coleta."
                },
                "filedAt": {
                  "type": "string",
                  "description": "Data/hora da juntada. Instantes conhecidos são apresentados em America/Sao_Paulo. Quando a fonte não informa timezone, preserva a data/hora local sem inventar offset. Ausente quando não informada."
                },
                "publicationDate": {
                  "type": "string",
                  "format": "date",
                  "description": "Data civil de publicação, quando informada; não é a data de juntada."
                }
              }
            }
          }
        }
      },
      "ResearchExpired": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "EXPIRED"
            ],
            "description": "Os dados da consulta não estão mais disponíveis."
          },
          "resultStatus": {
            "type": "string"
          },
          "dataAvailable": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "message": {
            "type": "string"
          },
          "error": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "RESEARCH_FAILED",
                  "TRIBUNAL_UNAVAILABLE",
                  "PROCESS_NOT_FOUND",
                  "REQUEST_TIMEOUT",
                  "RESEARCH_RESULT_EXPIRED"
                ]
              },
              "message": {
                "type": "string",
                "description": "Descrição do erro para o consumidor."
              }
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "requestId",
          "status",
          "resultStatus",
          "dataAvailable",
          "message",
          "error"
        ],
        "example": {
          "requestId": "11111111-1111-4111-8111-111111111111",
          "status": "EXPIRED",
          "resultStatus": "FOUND",
          "dataAvailable": false,
          "message": "Os dados desta consulta expiraram e não estão mais disponíveis. Crie uma nova pesquisa informando o CNJ em POST /v1/research-requests.",
          "error": {
            "code": "RESEARCH_RESULT_EXPIRED",
            "message": "Os dados desta consulta expiraram e não estão mais disponíveis. Crie uma nova pesquisa informando o CNJ em POST /v1/research-requests."
          }
        }
      },
      "RequestResearchAttachments": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid",
            "example": "11111111-1111-4111-8111-111111111111"
          },
          "attachmentId": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "requestId",
          "attachmentId"
        ]
      },
      "ResearchAttachmentsAccepted": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "attachmentId": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "ACCEPTED"
            ],
            "description": "Confirma o aceite desse anexo, inclusive em repetição; consulte o GET para o estado atual da coleta."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Criação da pesquisa original, em America/Sao_Paulo. Repetições não alteram a validade."
          }
        },
        "required": [
          "requestId",
          "attachmentId",
          "status",
          "createdAt"
        ],
        "example": {
          "requestId": "11111111-1111-4111-8111-111111111111",
          "attachmentId": "22222222-2222-4222-8222-222222222222",
          "status": "ACCEPTED",
          "createdAt": "2026-10-15T10:00:00.000-03:00"
        }
      },
      "ResearchAttachmentsRejected": {
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "requestId": {
                "type": "string",
                "format": "uuid"
              },
              "status": {
                "type": "string",
                "enum": [
                  "NO_DATA",
                  "FAILED"
                ]
              },
              "resultStatus": {
                "type": "string",
                "enum": [
                  "NOT_FOUND"
                ]
              },
              "dataAvailable": {
                "type": "boolean",
                "enum": [
                  false
                ]
              },
              "message": {
                "type": "string"
              },
              "error": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "code": {
                    "type": "string",
                    "enum": [
                      "RESEARCH_FAILED",
                      "TRIBUNAL_UNAVAILABLE",
                      "PROCESS_NOT_FOUND",
                      "REQUEST_TIMEOUT",
                      "RESEARCH_RESULT_EXPIRED"
                    ]
                  },
                  "message": {
                    "type": "string",
                    "description": "Descrição do erro para o consumidor."
                  }
                },
                "required": [
                  "code",
                  "message"
                ]
              }
            },
            "required": [
              "requestId",
              "status",
              "dataAvailable",
              "message",
              "error"
            ]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "statusCode": {
                "type": "integer",
                "enum": [
                  409
                ]
              },
              "message": {
                "type": "string"
              },
              "error": {
                "type": "string"
              }
            },
            "required": [
              "statusCode",
              "message",
              "error"
            ]
          }
        ]
      },
      "AttachmentPending": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "attachmentId": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "QUEUED",
              "PROCESSING"
            ]
          }
        },
        "required": [
          "requestId",
          "attachmentId",
          "status"
        ]
      },
      "CreateMonitoring": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "cnj": {
            "type": "string",
            "example": "0054874-11.2021.1.00.0000",
            "description": "CNJ com máscara ou 20 dígitos na entrada; mascarado na saída."
          },
          "instance": {
            "type": "string",
            "enum": [
              "1",
              "2",
              "3",
              "4"
            ],
            "description": "Instância do processo. Também aceita FIRST, SECOND, THIRD e FOURTH."
          },
          "syncNow": {
            "type": "boolean",
            "default": false,
            "description": "Solicita os dados atuais ao criar o monitoramento."
          }
        },
        "required": [
          "cnj",
          "instance"
        ]
      },
      "MonitoringAccepted": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "monitoringId": {
            "type": "string",
            "format": "uuid"
          },
          "monitoringSubscriptionId": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE"
            ]
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "monitoringId",
          "monitoringSubscriptionId",
          "status",
          "message"
        ]
      },
      "MonitoringListItem": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "monitoringId": {
            "type": "string",
            "format": "uuid"
          },
          "monitoringSubscriptionId": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "INACTIVE"
            ]
          },
          "updateStatus": {
            "type": "string",
            "enum": [
              "PENDING",
              "PROCESSING",
              "CHANGED",
              "UNCHANGED",
              "DEFERRED",
              "FAILED"
            ]
          },
          "cnj": {
            "type": "string",
            "example": "0054874-11.2021.1.00.0000",
            "description": "CNJ com máscara ou 20 dígitos na entrada; mascarado na saída."
          },
          "instance": {
            "type": "string",
            "enum": [
              "1",
              "2",
              "3",
              "4"
            ],
            "nullable": false
          },
          "lastSuccessfulCheckAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "nextCheckAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "initialSnapshotGeneratedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "monitoringId",
          "monitoringSubscriptionId",
          "status",
          "updateStatus",
          "cnj",
          "instance"
        ]
      },
      "MonitoringResult": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "monitoringId": {
            "type": "string",
            "format": "uuid"
          },
          "monitoringSubscriptionId": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "INACTIVE"
            ]
          },
          "updateStatus": {
            "type": "string",
            "enum": [
              "PENDING",
              "PROCESSING",
              "CHANGED",
              "UNCHANGED",
              "DEFERRED",
              "FAILED"
            ]
          },
          "cnj": {
            "type": "string",
            "example": "0054874-11.2021.1.00.0000",
            "description": "CNJ com máscara ou 20 dígitos na entrada; mascarado na saída."
          },
          "instance": {
            "type": "string",
            "enum": [
              "1",
              "2",
              "3",
              "4"
            ],
            "nullable": false
          },
          "lastSuccessfulCheckAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "nextCheckAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "initialSnapshotGeneratedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "courtName": {
            "type": "string",
            "nullable": true
          },
          "lastChangedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "error": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "nullable": true
          },
          "case": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "cnj": {
                "type": "string",
                "example": "0054874-11.2021.1.00.0000",
                "description": "CNJ com máscara ou 20 dígitos na entrada; mascarado na saída."
              },
              "court": {
                "type": "string",
                "nullable": true
              },
              "courtName": {
                "type": "string",
                "nullable": true
              },
              "instance": {
                "type": "string",
                "enum": [
                  "1",
                  "2",
                  "3",
                  "4"
                ],
                "nullable": true
              },
              "courtType": {
                "type": "string",
                "nullable": true
              },
              "caseClass": {
                "type": "string",
                "nullable": true
              },
              "mainSubject": {
                "type": "string",
                "nullable": true
              },
              "otherSubjects": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "status": {
                "type": "string",
                "nullable": true
              },
              "statusSource": {
                "type": "string",
                "nullable": true
              },
              "caseValue": {
                "type": "number",
                "nullable": true
              },
              "jurisdiction": {
                "type": "string",
                "nullable": true
              },
              "judgingBody": {
                "type": "string",
                "nullable": true
              },
              "judge": {
                "type": "string",
                "nullable": true
              },
              "distributionDate": {
                "type": "string",
                "format": "date",
                "nullable": true
              },
              "redistributionDate": {
                "type": "string",
                "format": "date",
                "nullable": true
              },
              "publicationDate": {
                "type": "string",
                "format": "date",
                "nullable": true
              },
              "noticeDate": {
                "type": "string",
                "format": "date",
                "nullable": true
              },
              "lastMovementDate": {
                "type": "string",
                "format": "date",
                "nullable": true
              },
              "captureDate": {
                "type": "string",
                "format": "date-time",
                "nullable": true
              },
              "lastUpdate": {
                "type": "string",
                "format": "date-time",
                "nullable": true
              },
              "relatedLawsuits": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "cnj": {
                      "type": "string",
                      "example": "0054874-11.2021.1.00.0000",
                      "description": "CNJ com máscara ou 20 dígitos na entrada; mascarado na saída."
                    },
                    "relationType": {
                      "type": "string",
                      "nullable": true
                    },
                    "classCode": {
                      "type": "string",
                      "nullable": true
                    },
                    "caseClass": {
                      "type": "string",
                      "nullable": true
                    },
                    "active": {
                      "type": "boolean",
                      "nullable": true
                    },
                    "rawDeletedAt": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                }
              },
              "classes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "code": {
                      "type": "string",
                      "nullable": true
                    },
                    "description": {
                      "type": "string",
                      "nullable": true
                    },
                    "hierarchy": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      ],
                      "nullable": true
                    },
                    "activePoleLabel": {
                      "type": "string",
                      "nullable": true
                    },
                    "passivePoleLabel": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                }
              },
              "subjects": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "code": {
                      "type": "string",
                      "nullable": true
                    },
                    "description": {
                      "type": "string",
                      "nullable": true
                    },
                    "hierarchy": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      ],
                      "nullable": true
                    },
                    "secondary": {
                      "oneOf": [
                        {
                          "type": "boolean"
                        },
                        {
                          "type": "string"
                        }
                      ],
                      "nullable": true
                    }
                  }
                }
              },
              "parties": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "name": {
                      "type": "string",
                      "nullable": true
                    },
                    "polarity": {
                      "type": "string",
                      "enum": [
                        "ACTIVE",
                        "PASSIVE",
                        "NEUTRAL"
                      ]
                    },
                    "role": {
                      "type": "string",
                      "nullable": true
                    },
                    "identifications": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "type": {
                            "type": "string",
                            "nullable": true
                          },
                          "number": {
                            "type": "string",
                            "nullable": true
                          }
                        }
                      }
                    },
                    "aliases": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "representatives": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "name": {
                            "type": "string",
                            "nullable": true
                          },
                          "role": {
                            "type": "string",
                            "nullable": true
                          },
                          "identifications": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "nullable": true
                                },
                                "number": {
                                  "type": "string",
                                  "nullable": true
                                }
                              }
                            }
                          },
                          "barRegistrations": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "properties": {
                                "number": {
                                  "type": "string",
                                  "nullable": true
                                },
                                "state": {
                                  "type": "string",
                                  "nullable": true
                                },
                                "type": {
                                  "type": "string",
                                  "nullable": true
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              "movements": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "occurredAt": {
                      "type": "string",
                      "format": "date-time",
                      "nullable": true
                    },
                    "rawOccurredAt": {
                      "type": "string",
                      "nullable": true,
                      "description": "Original preservado; pode não ter timezone."
                    },
                    "description": {
                      "type": "string",
                      "nullable": true
                    },
                    "title": {
                      "type": "string",
                      "nullable": true
                    },
                    "sequence": {
                      "type": "string",
                      "nullable": true
                    },
                    "attachmentIndexes": {
                      "type": "array",
                      "items": {
                        "type": "integer",
                        "minimum": 0,
                        "description": "Índice do anexo associado em attachments[] deste processo."
                      }
                    }
                  }
                }
              },
              "attachments": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "attachmentId": {
                      "type": "string",
                      "format": "uuid",
                      "description": "Identificador DataWho do anexo desta pesquisa/instância; informe-o na solicitação individual. Não é um identificador do fornecedor."
                    },
                    "name": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string",
                      "description": "Link privado DataWho, presente somente quando esse arquivo foi solicitado e está disponível. Ausência também pode indicar restrição ou falha; acompanhe o estado da coleta."
                    },
                    "filedAt": {
                      "type": "string",
                      "description": "Data/hora da juntada. Instantes conhecidos são apresentados em America/Sao_Paulo. Quando a fonte não informa timezone, preserva a data/hora local sem inventar offset. Ausente quando não informada."
                    },
                    "publicationDate": {
                      "type": "string",
                      "format": "date",
                      "description": "Data civil de publicação, quando informada; não é a data de juntada."
                    }
                  }
                }
              },
              "magistrates": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "name": {
                      "type": "string",
                      "nullable": true
                    },
                    "role": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                }
              },
              "distributions": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "sequence": {
                      "type": "string",
                      "nullable": true
                    },
                    "rawOccurredAt": {
                      "type": "string",
                      "nullable": true
                    },
                    "sourceDeleted": {
                      "type": "boolean",
                      "nullable": true
                    }
                  }
                }
              }
            }
          }
        },
        "required": [
          "monitoringId",
          "monitoringSubscriptionId",
          "status",
          "updateStatus",
          "cnj",
          "instance"
        ]
      },
      "MonitoringRemoved": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "monitoringId": {
            "type": "string",
            "format": "uuid"
          },
          "monitoringSubscriptionId": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "INACTIVE"
            ]
          }
        },
        "required": [
          "monitoringId",
          "monitoringSubscriptionId",
          "status"
        ]
      },
      "MonitoringInfo": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "monitoringId": {
            "type": "string",
            "format": "uuid"
          },
          "monitoringSubscriptionId": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "INACTIVE"
            ]
          },
          "updateStatus": {
            "type": "string",
            "enum": [
              "PENDING",
              "PROCESSING",
              "CHANGED",
              "UNCHANGED",
              "DEFERRED",
              "FAILED"
            ]
          },
          "cnj": {
            "type": "string",
            "example": "0054874-11.2021.1.00.0000",
            "description": "CNJ com máscara ou 20 dígitos na entrada; mascarado na saída."
          },
          "instance": {
            "type": "string",
            "enum": [
              "1",
              "2",
              "3",
              "4"
            ],
            "nullable": false
          },
          "lastSuccessfulCheckAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "nextCheckAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "initialSnapshotGeneratedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "courtName": {
            "type": "string",
            "nullable": true
          },
          "lastChangedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "error": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "nullable": true
          }
        },
        "required": [
          "monitoringId",
          "monitoringSubscriptionId",
          "status",
          "updateStatus",
          "cnj",
          "instance"
        ]
      },
      "MonitoringBatch": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "monitoringIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "minItems": 1,
            "maxItems": 100
          }
        },
        "required": [
          "monitoringIds"
        ]
      },
      "MonitoringBatchRemoved": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "INACTIVE"
            ]
          },
          "monitoringIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "count": {
            "type": "integer"
          }
        },
        "required": [
          "status",
          "monitoringIds",
          "count"
        ]
      }
    }
  }
}
