{
  "openapi": "3.1.0",
  "info": {
    "title": "SaaS RENTRI — dettaglio FIR con riepilogo",
    "version": "1.1.0",
    "description": "Step 4, estensione additiva. Documento/readiness/remoto/sync/rentri e ETag locali restano disponibili. Nessuna nuova interrogazione RENTRI nella GET. Riepilogo e azioni sono evidenze/indicazioni, non firme o autorizzazioni."
  },
  "paths": {
    "/api/v1/fir/{numero_fir}": {
      "get": {
        "operationId": "getClientFir",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-required-scope": "fir:read",
        "parameters": [
          {
            "name": "numero_fir",
            "in": "path",
            "required": true,
            "description": "Numero del FIR codificato come singolo segmento URL.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Documento locale confermato e ultima osservazione, no-store; ETag riguarda soltanto versione locale.",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "request_id",
                    "data"
                  ],
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "required": [
                        "numero_fir",
                        "versione",
                        "documento",
                        "riepilogo"
                      ],
                      "properties": {
                        "numero_fir": {
                          "type": "string"
                        },
                        "versione": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "documento": {
                          "type": "object"
                        },
                        "riepilogo": {
                          "$ref": "./fir-summary.schema.json#/$defs/Full"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Chiave non valida."
          },
          "403": {
            "description": "Scope o contesto non autorizzati."
          },
          "404": {
            "description": "FIR non appartenente al client o non trovato."
          },
          "409": {
            "description": "Nessuna versione locale confermata disponibile."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  }
}
