{
  "openapi": "3.0.3",
  "info": {
    "title": "API onboarding RENTRI — Step 6",
    "version": "1.0.0",
    "description": "Implementazione locale, disabilitata per default. Nessuna attivazione DEMO/PROD inclusa. Il client deriva dalla chiave autenticata; scope espliciti e limiti server-side."
  },
  "servers": [
    {
      "url": "/api/v1",
      "description": "Base URL del gateway dell’istanza scelta dal gestionale."
    }
  ],
  "security": [
    {
      "ApiKeyBearer": []
    }
  ],
  "paths": {
    "/onboarding": {
      "post": {
        "operationId": "onboardOperator",
        "summary": "Verifica e attiva il proprio accesso",
        "x-required-scopes": [
          "onboarding:write"
        ],
        "x-client-onboarding-enabled": true,
        "description": "Body massimo 6 MiB; 5 richieste/10 min per client e 20/10 min per IP. Un onboarding concorrente per client, due globali. Replay richiede sempre P12/password. Nessun rinnovo globale implicito.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{7,127}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OnboardingRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successo o risultato storico.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AttemptResponse"
                }
              }
            }
          },
          "202": {
            "description": "Tentativo già in corso, senza nuovo job.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AttemptResponse"
                }
              }
            }
          },
          "400": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/onboarding/{onboardingId}": {
      "get": {
        "operationId": "readOwnOnboarding",
        "summary": "Legge il proprio tentativo storico",
        "x-required-scopes": [
          "onboarding:read"
        ],
        "parameters": [
          {
            "name": "onboardingId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^onb_[a-f0-9]{32}$"
            }
          }
        ],
        "description": "60 richieste/min per client, 240/min per IP. Non riprende una verifica, non carica segreti e non dichiara grant attualmente utilizzabili.",
        "responses": {
          "200": {
            "description": "Successo o risultato storico.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AttemptResponse"
                }
              }
            }
          },
          "400": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/operator-accesses/{operatorId}": {
      "get": {
        "operationId": "readOwnOperatorAccess",
        "summary": "Legge stato e revisione del proprio accesso",
        "x-required-scopes": [
          "onboarding:read"
        ],
        "parameters": [
          {
            "name": "operatorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^op_[a-f0-9]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successo o risultato storico.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "removeOwnOperatorAccess",
        "summary": "Disabilita soltanto il proprio accesso",
        "x-required-scopes": [
          "operator-access:revoke"
        ],
        "parameters": [
          {
            "name": "operatorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^op_[a-f0-9]{32}$"
            }
          }
        ],
        "description": "Idempotente; 10 richieste/min per client e 60/min per IP. Nessun downgrade del blocco amministrativo o revoca di altri client.",
        "responses": {
          "200": {
            "description": "Successo o risultato storico.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Errore controllato; nessun dato sensibile.",
            "headers": {
              "X-Request-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1
                },
                "description": "Presente quando applicabile."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Tentativo creato, quando disponibile."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyBearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "agw_<ambiente>_<credential-id>.<secret>"
      }
    },
    "schemas": {
      "OnboardingRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "p12_base64",
          "password"
        ],
        "properties": {
          "p12_base64": {
            "type": "string",
            "minLength": 1,
            "maxLength": 5592408,
            "format": "byte",
            "description": "Base64 canonica senza whitespace. Massimo 4 MiB decodificati.",
            "writeOnly": true
          },
          "password": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4096,
            "x-maxBytes": 4096,
            "format": "password",
            "writeOnly": true,
            "description": "Massimo 4096 byte UTF-8, conservati esattamente senza trim."
          },
          "expected_subject": {
            "type": "string",
            "pattern": "^IT-[A-Z0-9]{1,32}$"
          },
          "reactivate": {
            "type": "boolean",
            "default": false
          },
          "expected_revision": {
            "type": "integer",
            "minimum": 0,
            "description": "Obbligatorio soltanto con reactivate=true; altrimenti deve essere assente."
          }
        }
      },
      "Attempt": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "status",
          "historical",
          "operator_id",
          "started_at",
          "finished_at",
          "next_attempt_at",
          "site_count",
          "role_count",
          "exclusions"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^onb_[a-f0-9]{32}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "running",
              "completed",
              "completed_with_exclusions",
              "no_eligible_sites",
              "deferred",
              "rejected",
              "conflict",
              "abandoned"
            ]
          },
          "historical": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "operator_id": {
            "type": "string",
            "nullable": true,
            "pattern": "^op_[a-f0-9]{32}$"
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "next_attempt_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "site_count": {
            "type": "integer",
            "minimum": 0
          },
          "role_count": {
            "type": "integer",
            "minimum": 0
          },
          "exclusions": {
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "minimum": 1
            }
          },
          "replayed": {
            "type": "boolean",
            "description": "Presente nelle risposte POST."
          }
        }
      },
      "Access": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "operator_id",
          "status",
          "revision",
          "valid_from",
          "valid_until",
          "reactivation"
        ],
        "properties": {
          "operator_id": {
            "type": "string",
            "pattern": "^op_[a-f0-9]{32}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "disabled"
            ]
          },
          "revision": {
            "type": "integer",
            "minimum": 0
          },
          "valid_from": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "valid_until": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "reactivation": {
            "type": "string",
            "enum": [
              "not_applicable",
              "fresh_proof_required",
              "administrative_action_required"
            ]
          }
        }
      },
      "AttemptResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "request_id",
          "data"
        ],
        "properties": {
          "request_id": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/Attempt"
          }
        }
      },
      "AccessResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "request_id",
          "data"
        ],
        "properties": {
          "request_id": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/Access"
          }
        }
      },
      "Error": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "request_id",
          "error"
        ],
        "properties": {
          "request_id": {
            "type": "string"
          },
          "error": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthenticated",
                  "forbidden",
                  "not_found",
                  "onboarding_conflict",
                  "payload_too_large",
                  "unsupported_media_type",
                  "onboarding_not_completed",
                  "rate_limited",
                  "concurrency_limited",
                  "onboarding_unavailable",
                  "internal_error"
                ]
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}
