{
    "openapi": "3.1.0",
    "info": {
        "title": "GedFlow",
        "version": "0.0.1",
        "description": "API v1 do GedFlow. Guias passo a passo (in\u00edcio r\u00e1pido, escopos, limites e webhooks) em [https:\/\/gedflow.com.br\/ajuda\/desenvolvedores](https:\/\/gedflow.com.br\/ajuda\/desenvolvedores)."
    },
    "servers": [
        {
            "url": "https:\/\/gedflow.com.br\/api"
        }
    ],
    "security": [
        {
            "http": []
        }
    ],
    "paths": {
        "\/v1\/app\/certificates": {
            "get": {
                "operationId": "app.certificates",
                "summary": "Certificados da prefeitura prontos para assinar",
                "tags": [
                    "App da prefeitura: autentica\u00e7\u00e3o",
                    "Authentication"
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "string"
                                                    },
                                                    "label": {
                                                        "type": "string"
                                                    },
                                                    "subject": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "valid_until": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "expiry_warning": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "label",
                                                    "subject",
                                                    "valid_until",
                                                    "expiry_warning"
                                                ]
                                            }
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/v1\/app\/deliveries\/{delivery}\/authenticate": {
            "post": {
                "operationId": "app.authentications.store",
                "summary": "Autenticar os documentos validados de uma entrega",
                "tags": [
                    "App da prefeitura: autentica\u00e7\u00e3o",
                    "Authentication"
                ],
                "parameters": [
                    {
                        "name": "delivery",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "certificate": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "certificate"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "string"
                                        },
                                        "status": {
                                            "type": "string"
                                        },
                                        "status_label": {
                                            "type": "string",
                                            "enum": [
                                                "Na fila",
                                                "Assinando",
                                                "Conclu\u00edda",
                                                "Conclu\u00edda com falhas"
                                            ]
                                        },
                                        "documents": {
                                            "type": "integer"
                                        },
                                        "authenticated": {
                                            "type": "integer",
                                            "minimum": 0
                                        },
                                        "failed": {
                                            "type": "integer",
                                            "minimum": 0
                                        },
                                        "requested_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "completed_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "failure_reason": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "receipt_url": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "Comprovante: p\u00e1gina leve de leitura (link assinado de poucos minutos)."
                                        }
                                    },
                                    "required": [
                                        "id",
                                        "status",
                                        "status_label",
                                        "documents",
                                        "authenticated",
                                        "failed",
                                        "requested_at",
                                        "completed_at",
                                        "failure_reason",
                                        "receipt_url"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/v1\/app\/authentications\/{authentication}": {
            "get": {
                "operationId": "app.authentications.show",
                "summary": "Andamento de uma autentica\u00e7\u00e3o e o comprovante",
                "tags": [
                    "App da prefeitura: autentica\u00e7\u00e3o",
                    "Authentication"
                ],
                "parameters": [
                    {
                        "name": "authentication",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "string"
                                        },
                                        "status": {
                                            "type": "string"
                                        },
                                        "status_label": {
                                            "type": "string",
                                            "enum": [
                                                "Na fila",
                                                "Assinando",
                                                "Conclu\u00edda",
                                                "Conclu\u00edda com falhas"
                                            ]
                                        },
                                        "documents": {
                                            "type": "integer"
                                        },
                                        "authenticated": {
                                            "type": "integer",
                                            "minimum": 0
                                        },
                                        "failed": {
                                            "type": "integer",
                                            "minimum": 0
                                        },
                                        "requested_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "completed_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "failure_reason": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "receipt_url": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "Comprovante: p\u00e1gina leve de leitura (link assinado de poucos minutos)."
                                        }
                                    },
                                    "required": [
                                        "id",
                                        "status",
                                        "status_label",
                                        "documents",
                                        "authenticated",
                                        "failed",
                                        "requested_at",
                                        "completed_at",
                                        "failure_reason",
                                        "receipt_url"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/v1\/app\/documents\/{document}\/files\/{file}\/viewer": {
            "get": {
                "operationId": "app.viewer",
                "summary": "Abrir um arquivo do documento no leitor do app",
                "tags": [
                    "App da prefeitura: documentos",
                    "Viewer"
                ],
                "parameters": [
                    {
                        "name": "document",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "file",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "url": {
                                            "type": "string"
                                        },
                                        "expires_in": {
                                            "type": "integer",
                                            "const": 600
                                        },
                                        "pages": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "url",
                                        "expires_in",
                                        "pages"
                                    ]
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "An error",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "description": "Error overview.",
                                            "examples": [
                                                "O arquivo ainda est\u00e1 em processamento."
                                            ]
                                        }
                                    },
                                    "required": [
                                        "message"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#\/components\/responses\/ModelNotFoundException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/v1\/app\/deliveries": {
            "get": {
                "operationId": "app.deliveries.index",
                "summary": "Entregas aguardando valida\u00e7\u00e3o e validadas",
                "tags": [
                    "App da prefeitura: entregas",
                    "Delivery"
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "string"
                                                    },
                                                    "code": {
                                                        "type": "string"
                                                    },
                                                    "status": {
                                                        "type": "string"
                                                    },
                                                    "status_label": {
                                                        "type": "string",
                                                        "enum": [
                                                            "Gerando e assinando",
                                                            "Aguardando valida\u00e7\u00e3o",
                                                            "Validado",
                                                            "Falhou"
                                                        ]
                                                    },
                                                    "documents": {
                                                        "type": "integer"
                                                    },
                                                    "delivered_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "pending_sample": {
                                                        "type": "integer",
                                                        "minimum": 0
                                                    },
                                                    "pending_authentication": {
                                                        "type": "integer",
                                                        "minimum": 0
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "code",
                                                    "status",
                                                    "status_label",
                                                    "documents",
                                                    "delivered_at",
                                                    "pending_sample",
                                                    "pending_authentication"
                                                ]
                                            }
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/v1\/app\/deliveries\/{delivery}": {
            "get": {
                "operationId": "app.deliveries.show",
                "summary": "Uma entrega, com os documentos e a amostra",
                "tags": [
                    "App da prefeitura: entregas",
                    "Delivery"
                ],
                "parameters": [
                    {
                        "name": "delivery",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "string"
                                        },
                                        "code": {
                                            "type": "string"
                                        },
                                        "status": {
                                            "type": "string"
                                        },
                                        "status_label": {
                                            "type": "string",
                                            "enum": [
                                                "Gerando e assinando",
                                                "Aguardando valida\u00e7\u00e3o",
                                                "Validado",
                                                "Falhou"
                                            ]
                                        },
                                        "documents": {
                                            "type": "integer"
                                        },
                                        "delivered_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "pending_sample": {
                                            "type": "integer",
                                            "minimum": 0
                                        },
                                        "pending_authentication": {
                                            "type": "integer",
                                            "minimum": 0
                                        },
                                        "sample_percent": {
                                            "type": [
                                                "integer",
                                                "null"
                                            ]
                                        },
                                        "timestamped": {
                                            "type": "boolean"
                                        },
                                        "validated_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "can_validate": {
                                            "type": "string"
                                        },
                                        "can_authenticate": {
                                            "type": "string"
                                        },
                                        "items": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "document": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "string"
                                                            },
                                                            "code": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "title": {
                                                                "type": "string"
                                                            },
                                                            "type": {
                                                                "type": "string"
                                                            },
                                                            "status": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "required": [
                                                            "id",
                                                            "code",
                                                            "title",
                                                            "type",
                                                            "status"
                                                        ]
                                                    },
                                                    "in_sample": {
                                                        "type": "boolean"
                                                    },
                                                    "opened": {
                                                        "type": "boolean"
                                                    },
                                                    "status": {
                                                        "type": "string"
                                                    },
                                                    "status_label": {
                                                        "type": "string",
                                                        "enum": [
                                                            "Aguardando valida\u00e7\u00e3o",
                                                            "Validado",
                                                            "Devolvido"
                                                        ]
                                                    },
                                                    "return_reason": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    }
                                                },
                                                "required": [
                                                    "document",
                                                    "in_sample",
                                                    "opened",
                                                    "status",
                                                    "status_label",
                                                    "return_reason"
                                                ]
                                            }
                                        },
                                        "authentications": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "string"
                                                    },
                                                    "status": {
                                                        "type": "string"
                                                    },
                                                    "status_label": {
                                                        "type": "string",
                                                        "enum": [
                                                            "Na fila",
                                                            "Assinando",
                                                            "Conclu\u00edda",
                                                            "Conclu\u00edda com falhas"
                                                        ]
                                                    },
                                                    "documents": {
                                                        "type": "integer"
                                                    },
                                                    "authenticated": {
                                                        "type": "integer",
                                                        "minimum": 0
                                                    },
                                                    "failed": {
                                                        "type": "integer",
                                                        "minimum": 0
                                                    },
                                                    "requested_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "completed_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "failure_reason": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "receipt_url": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Comprovante: p\u00e1gina leve de leitura (link assinado de poucos minutos)."
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "status",
                                                    "status_label",
                                                    "documents",
                                                    "authenticated",
                                                    "failed",
                                                    "requested_at",
                                                    "completed_at",
                                                    "failure_reason",
                                                    "receipt_url"
                                                ]
                                            }
                                        }
                                    },
                                    "required": [
                                        "id",
                                        "code",
                                        "status",
                                        "status_label",
                                        "documents",
                                        "delivered_at",
                                        "pending_sample",
                                        "pending_authentication",
                                        "sample_percent",
                                        "timestamped",
                                        "validated_at",
                                        "can_validate",
                                        "can_authenticate",
                                        "items",
                                        "authentications"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/v1\/app\/deliveries\/{delivery}\/items\/{document}\/open": {
            "post": {
                "operationId": "app.deliveries.open",
                "summary": "Conferir um documento da entrega (marca a amostra como aberta)",
                "tags": [
                    "App da prefeitura: entregas",
                    "Delivery"
                ],
                "parameters": [
                    {
                        "name": "delivery",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "document",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "opened": {
                                            "type": "boolean"
                                        }
                                    },
                                    "required": [
                                        "opened"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/v1\/app\/deliveries\/{delivery}\/items\/{document}\/return": {
            "post": {
                "operationId": "app.deliveries.return",
                "summary": "Devolver um documento para a empresa corrigir",
                "tags": [
                    "App da prefeitura: entregas",
                    "Delivery"
                ],
                "parameters": [
                    {
                        "name": "delivery",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "document",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "reason": {
                                        "type": "string",
                                        "minLength": 5,
                                        "maxLength": 1000
                                    }
                                },
                                "required": [
                                    "reason"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "status"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/v1\/app\/deliveries\/{delivery}\/validate": {
            "post": {
                "operationId": "app.deliveries.validate",
                "summary": "Validar a entrega: os documentos n\u00e3o devolvidos ficam validados",
                "tags": [
                    "App da prefeitura: entregas",
                    "Delivery"
                ],
                "parameters": [
                    {
                        "name": "delivery",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "string"
                                        },
                                        "code": {
                                            "type": "string"
                                        },
                                        "status": {
                                            "type": "string"
                                        },
                                        "status_label": {
                                            "type": "string",
                                            "enum": [
                                                "Gerando e assinando",
                                                "Aguardando valida\u00e7\u00e3o",
                                                "Validado",
                                                "Falhou"
                                            ]
                                        },
                                        "documents": {
                                            "type": "integer"
                                        },
                                        "delivered_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "pending_sample": {
                                            "type": "integer",
                                            "minimum": 0
                                        },
                                        "pending_authentication": {
                                            "type": "integer",
                                            "minimum": 0
                                        }
                                    },
                                    "required": [
                                        "id",
                                        "code",
                                        "status",
                                        "status_label",
                                        "documents",
                                        "delivered_at",
                                        "pending_sample",
                                        "pending_authentication"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/v1\/app\/profile": {
            "get": {
                "operationId": "app.profile",
                "summary": "Quem sou eu no app: permiss\u00f5es e fun\u00e7\u00f5es dispon\u00edveis",
                "tags": [
                    "App da prefeitura: in\u00edcio",
                    "Home"
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "string"
                                        },
                                        "name": {
                                            "type": "string"
                                        },
                                        "email": {
                                            "type": "string"
                                        },
                                        "tenant": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "string"
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "slug": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "id",
                                                "name",
                                                "slug"
                                            ]
                                        },
                                        "features": {
                                            "type": "object",
                                            "properties": {
                                                "search": {
                                                    "type": "string"
                                                },
                                                "validate": {
                                                    "type": "boolean"
                                                },
                                                "authenticate": {
                                                    "type": "boolean"
                                                },
                                                "dashboard": {
                                                    "type": "boolean"
                                                },
                                                "sensitive": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "search",
                                                "validate",
                                                "authenticate",
                                                "dashboard",
                                                "sensitive"
                                            ]
                                        },
                                        "profile_url": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "id",
                                        "name",
                                        "email",
                                        "tenant",
                                        "features",
                                        "profile_url"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/v1\/app\/home": {
            "get": {
                "operationId": "app.home",
                "summary": "Pend\u00eancias do usu\u00e1rio e um resumo do acervo",
                "tags": [
                    "App da prefeitura: in\u00edcio",
                    "Home"
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "pending": {
                                            "type": "object",
                                            "properties": {
                                                "deliveries_to_validate": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "minimum": 0
                                                },
                                                "documents_to_authenticate": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "sample_to_check": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "deliveries_to_validate",
                                                "documents_to_authenticate",
                                                "sample_to_check"
                                            ]
                                        },
                                        "certificate_warnings": {
                                            "type": "array",
                                            "items": {
                                                "type": [
                                                    "object",
                                                    "null"
                                                ],
                                                "properties": {
                                                    "label": {
                                                        "type": "string"
                                                    },
                                                    "warning": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    }
                                                },
                                                "required": [
                                                    "label",
                                                    "warning"
                                                ]
                                            }
                                        },
                                        "totals": {}
                                    },
                                    "required": [
                                        "pending",
                                        "certificate_warnings",
                                        "totals"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/v1\/app\/dashboard": {
            "get": {
                "operationId": "app.dashboard",
                "summary": "Painel do gestor resumido (mesmo recorte do \/app: o gestor de setor v\u00ea s\u00f3 os setores dele)",
                "tags": [
                    "App da prefeitura: in\u00edcio",
                    "Home"
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "totals": {},
                                        "monthly": {
                                            "type": "array",
                                            "items": {}
                                        },
                                        "documents_by_status": {},
                                        "boxes_by_status": {},
                                        "forecast": {},
                                        "deliveries": {
                                            "type": "array",
                                            "items": {}
                                        }
                                    },
                                    "required": [
                                        "totals",
                                        "monthly",
                                        "documents_by_status",
                                        "boxes_by_status",
                                        "forecast",
                                        "deliveries"
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "An error",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "description": "Error overview.",
                                            "examples": [
                                                "Sem permiss\u00e3o para o painel do gestor."
                                            ]
                                        }
                                    },
                                    "required": [
                                        "message"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/v1\/app\/devices": {
            "post": {
                "operationId": "app.devices.store",
                "summary": "Registrar (ou atualizar) este aparelho para receber notifica\u00e7\u00f5es",
                "tags": [
                    "App da prefeitura: notifica\u00e7\u00f5es",
                    "Device"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "expo_token": {
                                        "type": "string",
                                        "pattern": "^(Expo|Exponent)PushToken\\[[A-Za-z0-9_-]+\\]$",
                                        "maxLength": 200
                                    },
                                    "platform": {
                                        "type": "string",
                                        "enum": [
                                            "android",
                                            "ios"
                                        ]
                                    },
                                    "app": {
                                        "type": "string",
                                        "enum": [
                                            "prefeitura",
                                            "operacao"
                                        ]
                                    }
                                },
                                "required": [
                                    "expo_token",
                                    "platform",
                                    "app"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/v1\/app\/devices\/current": {
            "patch": {
                "operationId": "app.devices.update",
                "summary": "Ligar ou desligar as notifica\u00e7\u00f5es neste aparelho",
                "tags": [
                    "App da prefeitura: notifica\u00e7\u00f5es",
                    "Device"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "notifications_enabled": {
                                        "type": "boolean"
                                    }
                                },
                                "required": [
                                    "notifications_enabled"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "string"
                                        },
                                        "app": {
                                            "type": "string"
                                        },
                                        "platform": {
                                            "type": "string"
                                        },
                                        "notifications_enabled": {
                                            "type": "boolean"
                                        }
                                    },
                                    "required": [
                                        "id",
                                        "app",
                                        "platform",
                                        "notifications_enabled"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            },
            "delete": {
                "operationId": "app.devices.destroy",
                "summary": "Parar de receber notifica\u00e7\u00f5es neste aparelho",
                "tags": [
                    "App da prefeitura: notifica\u00e7\u00f5es",
                    "Device"
                ],
                "responses": {
                    "204": {
                        "description": "No content"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/v1\/verify\/{code}": {
            "get": {
                "operationId": "verify",
                "summary": "Verificar um c\u00f3digo de autentica\u00e7\u00e3o",
                "tags": [
                    "App da prefeitura: verifica\u00e7\u00e3o",
                    "Verify"
                ],
                "parameters": [
                    {
                        "name": "code",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "code": {
                                            "type": "string"
                                        },
                                        "current": {
                                            "type": "string"
                                        },
                                        "tenant": {
                                            "type": "string"
                                        },
                                        "document_type": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "authenticated_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "files": {
                                            "type": "string"
                                        },
                                        "url": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "code",
                                        "current",
                                        "tenant",
                                        "document_type",
                                        "authenticated_at",
                                        "files",
                                        "url"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#\/components\/responses\/ModelNotFoundException"
                    }
                },
                "security": []
            }
        },
        "\/v1\/documents\/{document}\/files\/{file}\/download": {
            "get": {
                "operationId": "files.download",
                "description": "Vale poucos minutos. Exige o escopo `download`.",
                "summary": "URL de download",
                "tags": [
                    "Arquivos",
                    "File"
                ],
                "parameters": [
                    {
                        "name": "document",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "file",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "url": {
                                            "type": "string"
                                        },
                                        "expires_at": {
                                            "type": "string"
                                        },
                                        "authenticated": {
                                            "type": "boolean"
                                        },
                                        "sha256": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "url",
                                        "expires_at",
                                        "authenticated",
                                        "sha256"
                                    ]
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "An error",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "description": "Error overview.",
                                            "examples": [
                                                "O arquivo ainda est\u00e1 em processamento."
                                            ]
                                        }
                                    },
                                    "required": [
                                        "message"
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "$ref": "#\/components\/responses\/AuthorizationException"
                    },
                    "404": {
                        "$ref": "#\/components\/responses\/ModelNotFoundException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/v1\/documents\/{document}\/files": {
            "post": {
                "operationId": "files.store",
                "summary": "Acrescentar um arquivo (corpo, prancha ou anexo) ao documento",
                "tags": [
                    "Arquivos",
                    "File"
                ],
                "parameters": [
                    {
                        "name": "document",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "kind": {
                                        "$ref": "#\/components\/schemas\/DocumentFileKind"
                                    },
                                    "label": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 255
                                    }
                                },
                                "required": [
                                    "kind"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "string"
                                        },
                                        "kind": {
                                            "type": "string"
                                        },
                                        "label": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "id",
                                        "kind",
                                        "label"
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "$ref": "#\/components\/responses\/AuthorizationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/v1\/files\/{file}\/uploads": {
            "post": {
                "operationId": "uploads.start",
                "description": "Informe o SHA-256 do arquivo; a resposta traz o tamanho e o n\u00famero das partes.",
                "summary": "Abrir envio",
                "tags": [
                    "Arquivos",
                    "File"
                ],
                "parameters": [
                    {
                        "name": "file",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "filename": {
                                        "type": "string",
                                        "maxLength": 255
                                    },
                                    "mime": {
                                        "type": "string",
                                        "maxLength": 127
                                    },
                                    "size": {
                                        "type": "integer",
                                        "minimum": 1
                                    },
                                    "sha256": {
                                        "type": "string",
                                        "pattern": "^[0-9a-f]{64}$"
                                    },
                                    "reason": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 1000
                                    },
                                    "digitized_at": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time"
                                    },
                                    "digitization_place": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 255
                                    }
                                },
                                "required": [
                                    "filename",
                                    "mime",
                                    "size",
                                    "sha256"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "version": {
                                            "type": "string"
                                        },
                                        "part_size": {
                                            "type": [
                                                "string",
                                                "integer"
                                            ]
                                        },
                                        "part_count": {},
                                        "completed": {
                                            "type": [
                                                "string",
                                                "boolean"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "version",
                                        "part_size",
                                        "part_count",
                                        "completed"
                                    ]
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "An error",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "description": "Error overview.",
                                            "examples": [
                                                "J\u00e1 existe um arquivo id\u00eantico (mesmo SHA-256) nesta prefeitura."
                                            ]
                                        }
                                    },
                                    "required": [
                                        "message"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/v1\/uploads\/{version}\/parts": {
            "post": {
                "operationId": "uploads.sign",
                "summary": "Assinar partes: URLs pr\u00e9-assinadas para enviar cada parte (PUT)",
                "tags": [
                    "Arquivos",
                    "File"
                ],
                "parameters": [
                    {
                        "name": "version",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "parts": {
                                        "type": "array",
                                        "items": {
                                            "type": "integer",
                                            "minimum": 1
                                        },
                                        "minItems": 1,
                                        "maxItems": 50
                                    }
                                },
                                "required": [
                                    "parts"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "urls": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        }
                                    },
                                    "required": [
                                        "urls"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/v1\/uploads\/{version}\/complete": {
            "post": {
                "operationId": "uploads.complete",
                "summary": "Concluir envio, com o ETag de cada parte",
                "tags": [
                    "Arquivos",
                    "File"
                ],
                "parameters": [
                    {
                        "name": "version",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "parts": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "number": {
                                                    "type": "integer",
                                                    "minimum": 1
                                                },
                                                "etag": {
                                                    "type": "string",
                                                    "maxLength": 255
                                                }
                                            },
                                            "required": [
                                                "number",
                                                "etag"
                                            ]
                                        },
                                        "minItems": 1
                                    }
                                },
                                "required": [
                                    "parts"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "version": {
                                            "type": "string"
                                        },
                                        "number": {
                                            "type": "integer"
                                        },
                                        "status": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "version",
                                        "number",
                                        "status"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/v1\/uploads\/{version}": {
            "delete": {
                "operationId": "uploads.abort",
                "summary": "Cancelar envio",
                "tags": [
                    "Arquivos",
                    "File"
                ],
                "parameters": [
                    {
                        "name": "version",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No content"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/v1\/auth\/login": {
            "post": {
                "operationId": "auth.login",
                "description": "Devolve um token Bearer para o aparelho informado.",
                "summary": "Entrar",
                "tags": [
                    "Autentica\u00e7\u00e3o dos apps",
                    "Auth"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "email": {
                                        "type": "string",
                                        "format": "email"
                                    },
                                    "password": {
                                        "type": "string"
                                    },
                                    "device_name": {
                                        "type": "string",
                                        "maxLength": 120
                                    }
                                },
                                "required": [
                                    "email",
                                    "password",
                                    "device_name"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "token": {
                                            "type": "string"
                                        },
                                        "expires_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "user": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "string"
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "tenant": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "id",
                                                "name",
                                                "tenant"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "token",
                                        "expires_at",
                                        "user"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                },
                "security": []
            }
        },
        "\/v1\/me": {
            "get": {
                "operationId": "me",
                "summary": "Quem sou eu",
                "tags": [
                    "Autentica\u00e7\u00e3o dos apps",
                    "Auth"
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "string"
                                        },
                                        "name": {
                                            "type": "string"
                                        },
                                        "tenant": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "string"
                                                },
                                                "name": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "id",
                                                "name"
                                            ]
                                        },
                                        "integration": {
                                            "type": [
                                                "object",
                                                "null"
                                            ],
                                            "properties": {
                                                "id": {
                                                    "type": "string"
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "scopes": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                }
                                            },
                                            "required": [
                                                "id",
                                                "name",
                                                "scopes"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "id",
                                        "name",
                                        "tenant",
                                        "integration"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/v1\/auth\/logout": {
            "post": {
                "operationId": "auth.logout",
                "summary": "Sair (revoga o token deste aparelho)",
                "tags": [
                    "Autentica\u00e7\u00e3o dos apps",
                    "Auth"
                ],
                "responses": {
                    "204": {
                        "description": "No content"
                    },
                    "403": {
                        "description": "An error",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "description": "Error overview.",
                                            "examples": [
                                                "Tokens de integra\u00e7\u00e3o s\u00e3o revogados pela prefeitura no \/app."
                                            ]
                                        }
                                    },
                                    "required": [
                                        "message"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/v1\/search": {
            "get": {
                "operationId": "search",
                "description": "Texto livre nos metadados e no OCR; aspas para frase exata.",
                "summary": "Buscar",
                "tags": [
                    "Busca",
                    "Search"
                ],
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "maxLength": 300
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "schema": {
                            "type": [
                                "integer",
                                "null"
                            ],
                            "minimum": 1,
                            "maximum": 100
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "schema": {
                            "type": [
                                "integer",
                                "null"
                            ],
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": {
                                                "type": "object",
                                                "properties": {
                                                    "document": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "page": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ]
                                                    },
                                                    "snippet": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    }
                                                },
                                                "required": [
                                                    "document",
                                                    "page",
                                                    "snippet"
                                                ]
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "page": {
                                                    "type": "integer"
                                                },
                                                "per_page": {
                                                    "type": "integer"
                                                }
                                            },
                                            "required": [
                                                "total",
                                                "page",
                                                "per_page"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "meta"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/v1\/lookup": {
            "get": {
                "operationId": "lookup",
                "description": "Ex.: `?field=inscricao&value=01.02.003`. Campo sens\u00edvel exige o escopo `sensitive`.",
                "summary": "Consultar por campo",
                "tags": [
                    "Busca",
                    "Search"
                ],
                "parameters": [
                    {
                        "name": "field",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "maxLength": 60
                        }
                    },
                    {
                        "name": "value",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "maxLength": 255
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Array of `DocumentResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#\/components\/schemas\/DocumentResource"
                                            }
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    },
                    "403": {
                        "description": "An error",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "description": "Error overview.",
                                            "examples": [
                                                "Consulta por campo sens\u00edvel exige o escopo \"sensitive\"."
                                            ]
                                        }
                                    },
                                    "required": [
                                        "message"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/v1\/document-types": {
            "get": {
                "operationId": "catalog.types",
                "summary": "Tipos documentais ativos",
                "tags": [
                    "Cat\u00e1logo",
                    "Catalog"
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "string"
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "classification": {
                                                        "type": "string"
                                                    },
                                                    "default_confidentiality": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "name",
                                                    "classification",
                                                    "default_confidentiality"
                                                ]
                                            }
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/v1\/sectors": {
            "get": {
                "operationId": "catalog.sectors",
                "summary": "Setores ativos",
                "tags": [
                    "Cat\u00e1logo",
                    "Catalog"
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "string"
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "name"
                                                ]
                                            }
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/v1\/fields": {
            "get": {
                "operationId": "catalog.fields",
                "description": "Informe `sector` e `document_type` para a ficha completa daquela combina\u00e7\u00e3o.",
                "summary": "Campos da ficha",
                "tags": [
                    "Cat\u00e1logo",
                    "Catalog"
                ],
                "parameters": [
                    {
                        "name": "sector",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "document_type",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "key": {
                                                        "type": "string"
                                                    },
                                                    "label": {
                                                        "type": "string"
                                                    },
                                                    "type": {
                                                        "type": "string"
                                                    },
                                                    "options": {
                                                        "type": [
                                                            "array",
                                                            "null"
                                                        ],
                                                        "items": {}
                                                    },
                                                    "required": {
                                                        "type": "boolean"
                                                    },
                                                    "sensitive": {
                                                        "type": "boolean"
                                                    },
                                                    "visible": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "key",
                                                    "label",
                                                    "type",
                                                    "options",
                                                    "required",
                                                    "sensitive",
                                                    "visible"
                                                ]
                                            }
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/v1\/documents": {
            "get": {
                "operationId": "documents.index",
                "description": "Filtros opcionais; use `updated_since` para sincronizar s\u00f3 o que mudou.",
                "summary": "Listar documentos",
                "tags": [
                    "Documentos",
                    "Document"
                ],
                "parameters": [
                    {
                        "name": "document_type",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ]
                        }
                    },
                    {
                        "name": "sector",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ]
                        }
                    },
                    {
                        "name": "category_code",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "maxLength": 60
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "maxLength": 20
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "schema": {
                            "type": [
                                "integer",
                                "null"
                            ],
                            "minimum": 1,
                            "maximum": 100
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Paginated set of `DocumentResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#\/components\/schemas\/DocumentResource"
                                            }
                                        },
                                        "links": {
                                            "type": "object",
                                            "properties": {
                                                "first": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "last": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "prev": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "next": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "first",
                                                "last",
                                                "prev",
                                                "next"
                                            ]
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "current_page": {
                                                    "type": "integer",
                                                    "minimum": 1
                                                },
                                                "from": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "minimum": 1
                                                },
                                                "last_page": {
                                                    "type": "integer",
                                                    "minimum": 1
                                                },
                                                "links": {
                                                    "type": "array",
                                                    "description": "Generated paginator links.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "url": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "label": {
                                                                "type": "string"
                                                            },
                                                            "active": {
                                                                "type": "boolean"
                                                            }
                                                        },
                                                        "required": [
                                                            "url",
                                                            "label",
                                                            "active"
                                                        ]
                                                    }
                                                },
                                                "path": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Base path for paginator generated URLs."
                                                },
                                                "per_page": {
                                                    "type": "integer",
                                                    "description": "Number of items shown per page.",
                                                    "minimum": 0
                                                },
                                                "to": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Number of the last item in the slice.",
                                                    "minimum": 1
                                                },
                                                "total": {
                                                    "type": "integer",
                                                    "description": "Total number of items being paginated.",
                                                    "minimum": 0
                                                }
                                            },
                                            "required": [
                                                "current_page",
                                                "from",
                                                "last_page",
                                                "links",
                                                "path",
                                                "per_page",
                                                "to",
                                                "total"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "links",
                                        "meta"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            },
            "post": {
                "operationId": "documents.store",
                "description": "Exige o escopo `documents:write` e um setor dentro do recorte da integra\u00e7\u00e3o.",
                "summary": "Cadastrar documento",
                "tags": [
                    "Documentos",
                    "Document"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "sector": {
                                        "type": "string"
                                    },
                                    "document_type": {
                                        "type": "string"
                                    },
                                    "title": {
                                        "type": "string",
                                        "maxLength": 255
                                    },
                                    "subject": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 2000
                                    },
                                    "author": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 255
                                    },
                                    "produced_at": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date"
                                    },
                                    "produced_place": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 255
                                    },
                                    "confidentiality": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "enum": [
                                            "public",
                                            "restricted",
                                            "confidential",
                                            null
                                        ]
                                    },
                                    "custom_fields": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "items": {
                                            "type": "string"
                                        }
                                    }
                                },
                                "required": [
                                    "sector",
                                    "document_type",
                                    "title"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "`DocumentResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/DocumentResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "$ref": "#\/components\/responses\/AuthorizationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/v1\/documents\/{document}": {
            "get": {
                "operationId": "documents.show",
                "summary": "Detalhe de um documento: metadados, ficha, arquivos, hashes e autentica\u00e7\u00e3o",
                "tags": [
                    "Documentos",
                    "Document"
                ],
                "parameters": [
                    {
                        "name": "document",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`DocumentResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/DocumentResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "403": {
                        "$ref": "#\/components\/responses\/AuthorizationException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "http": {
                "type": "http",
                "scheme": "bearer"
            }
        },
        "schemas": {
            "DocumentFileKind": {
                "type": "string",
                "description": "Papel do arquivo dentro do documento (ARQUITETURA, se\u00e7\u00e3o 5).\n",
                "enum": [
                    "body",
                    "sheet",
                    "annex"
                ],
                "title": "DocumentFileKind"
            },
            "DocumentResource": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "code": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "title": {
                        "type": "string"
                    },
                    "subject": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "author": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "produced_at": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "produced_at_precision": {
                        "type": "string"
                    },
                    "produced_place": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "confidentiality": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string"
                    },
                    "document_type": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "name": {
                                "type": "string"
                            }
                        },
                        "required": [
                            "id",
                            "name"
                        ]
                    },
                    "classification": {
                        "type": "object",
                        "properties": {
                            "code": {
                                "type": "string"
                            },
                            "name": {
                                "type": "string"
                            },
                            "final_destination": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        },
                        "required": [
                            "code",
                            "name",
                            "final_destination"
                        ]
                    },
                    "sector": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "name": {
                                "type": "string"
                            }
                        },
                        "required": [
                            "id",
                            "name"
                        ]
                    },
                    "custom_fields": {
                        "type": "object",
                        "additionalProperties": {}
                    },
                    "files": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "string"
                                },
                                "kind": {
                                    "type": "string"
                                },
                                "label": {
                                    "type": "string"
                                },
                                "current_version": {
                                    "type": [
                                        "object",
                                        "null"
                                    ],
                                    "properties": {
                                        "id": {
                                            "type": "string"
                                        },
                                        "number": {
                                            "type": "integer"
                                        },
                                        "status": {
                                            "type": "string"
                                        },
                                        "pages": {
                                            "type": [
                                                "integer",
                                                "null"
                                            ]
                                        },
                                        "sha256": {
                                            "type": "string"
                                        },
                                        "master_sha256": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "id",
                                        "number",
                                        "status",
                                        "pages",
                                        "sha256",
                                        "master_sha256"
                                    ]
                                }
                            },
                            "required": [
                                "id",
                                "kind",
                                "label",
                                "current_version"
                            ]
                        }
                    },
                    "authentication": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "verification_code": {
                                "type": "string"
                            },
                            "verification_url": {
                                "type": "string"
                            },
                            "authenticated_at": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        },
                        "required": [
                            "verification_code",
                            "verification_url",
                            "authenticated_at"
                        ]
                    },
                    "created_at": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "updated_at": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                },
                "required": [
                    "id",
                    "code",
                    "title",
                    "subject",
                    "author",
                    "produced_at",
                    "produced_at_precision",
                    "produced_place",
                    "confidentiality",
                    "status",
                    "document_type",
                    "classification",
                    "sector",
                    "custom_fields",
                    "created_at",
                    "updated_at"
                ],
                "title": "DocumentResource"
            },
            "User": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "public_id": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "email": {
                        "type": "string"
                    },
                    "kind": {
                        "$ref": "#\/components\/schemas\/UserKind"
                    },
                    "is_active": {
                        "type": "boolean"
                    },
                    "email_verified_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "created_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "updated_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "tenant_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "api_integration_id": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    }
                },
                "required": [
                    "id",
                    "public_id",
                    "name",
                    "email",
                    "kind",
                    "is_active",
                    "email_verified_at",
                    "created_at",
                    "updated_at",
                    "tenant_id",
                    "api_integration_id"
                ],
                "title": "User"
            },
            "UserKind": {
                "type": "string",
                "description": "Contexto de um usu\u00e1rio: define qual painel ele pode acessar. - company: equipe administrativa da empresa (painel \/admin). - staff: colaborador da opera\u00e7\u00e3o de digitaliza\u00e7\u00e3o (painel \/sys). - tenant: usu\u00e1rio de uma prefeitura (painel \/app).  Os pap\u00e9is dentro de cada painel (spatie\/permission) entram na Fase 1.\n",
                "enum": [
                    "company",
                    "staff",
                    "tenant"
                ],
                "title": "UserKind"
            }
        },
        "responses": {
            "ValidationException": {
                "description": "Validation error",
                "content": {
                    "application\/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "message": {
                                    "type": "string",
                                    "description": "Errors overview."
                                },
                                "errors": {
                                    "type": "object",
                                    "description": "A detailed description of each field that failed validation.",
                                    "additionalProperties": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    }
                                }
                            },
                            "required": [
                                "message",
                                "errors"
                            ]
                        }
                    }
                }
            },
            "ModelNotFoundException": {
                "description": "Not found",
                "content": {
                    "application\/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "message": {
                                    "type": "string",
                                    "description": "Error overview."
                                }
                            },
                            "required": [
                                "message"
                            ]
                        }
                    }
                }
            },
            "AuthenticationException": {
                "description": "Unauthenticated",
                "content": {
                    "application\/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "message": {
                                    "type": "string",
                                    "description": "Error overview."
                                }
                            },
                            "required": [
                                "message"
                            ]
                        }
                    }
                }
            },
            "AuthorizationException": {
                "description": "Authorization error",
                "content": {
                    "application\/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "message": {
                                    "type": "string",
                                    "description": "Error overview."
                                }
                            },
                            "required": [
                                "message"
                            ]
                        }
                    }
                }
            }
        }
    }
}