{
  "openapi": "3.1.0",
  "info": {
    "title": "Rubrica privata delle controparti",
    "version": "1.1.0",
    "description": "Locale per client/operatore, condivisa tra sedi autorizzate. Nessuna chiamata RENTRI, grant o compilazione automatica dei FIR. Gate false per default, PROD richiede anche RENTRI_RUBRICA_PROD_ENABLED e deployment vincolato. Bozze ammesse, fino a5000 schede per client/operatore. Duplicati409 anche se disattivati; ripetere POST non è un replay idempotente: cercare per codice dopo timeout. Il codice gestionale e il tipo restano immutabili. PATCH richiede versione corrente e almeno un altro campo. Nessun DELETE. JSON grezzo max16384byte, campi sconosciuti o doppie query rifiutati. Testo normalizzato con trim, CF/nazione/sito uppercase. Oggetti annidati vuoti rifiutati. La compilazione non garantisce il mapping/accettazione nativa: validare il documento intero. Non sostituire le liste del FIR quando si aggiunge un elemento senza preservare quelli già selezionati. Dal rilascio M7 il tipo producer compila un oggetto produttore esterno; non crea un operatore SaaS."
  },
  "x-implementation-status": "implemented-demo-prod-offline-tested-disabled-by-default",
  "x-performs-remote-read": false,
  "x-creates-or-mutates-fir": false,
  "x-assigns-operator-access": false,
  "x-default-enabled": false,
  "paths": {
    "/api/v1/operators/{operator_id}/controparti": {
      "get": {
        "summary": "Cerca nella rubrica privata dell’operatore",
        "operationId": "rubrica_get_list",
        "security": [
          {
            "bearer": []
          }
        ],
        "x-required-scope": "rubrica:read",
        "parameters": [
          {
            "in": "path",
            "name": "operator_id",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^op_[a-f0-9]{32}$"
            }
          },
          {
            "in": "query",
            "name": "tipo",
            "schema": {
              "enum": [
                "transporter",
                "destination",
                "intermediary",
                "producer"
              ]
            }
          },
          {
            "in": "query",
            "name": "attiva",
            "schema": {
              "enum": [
                "true",
                "false",
                "tutte"
              ],
              "default": "true"
            }
          },
          {
            "in": "query",
            "name": "codice",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,79}$"
            }
          },
          {
            "in": "query",
            "name": "q",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 4096
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Esito locale",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store, private"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "request_id",
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Counterparty"
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "limit": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 100
                        },
                        "next_cursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "limit",
                        "next_cursor"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "413": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "422": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Salva una scheda locale senza assegnare accessi",
        "operationId": "rubrica_post_list",
        "security": [
          {
            "bearer": []
          }
        ],
        "x-required-scope": "rubrica:write",
        "parameters": [
          {
            "in": "path",
            "name": "operator_id",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^op_[a-f0-9]{32}$"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Esito locale",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store, private"
                }
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "URL relativo della scheda creata"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Counterparty"
                    }
                  },
                  "required": [
                    "request_id",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "413": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "422": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Create"
              }
            }
          }
        }
      }
    },
    "/api/v1/operators/{operator_id}/controparti/{counterparty_id}": {
      "get": {
        "summary": "Legge una scheda anche disattivata",
        "operationId": "rubrica_get_detail",
        "security": [
          {
            "bearer": []
          }
        ],
        "x-required-scope": "rubrica:read",
        "parameters": [
          {
            "in": "path",
            "name": "operator_id",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^op_[a-f0-9]{32}$"
            }
          },
          {
            "in": "path",
            "name": "counterparty_id",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^ctp_[a-f0-9]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Esito locale",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store, private"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Counterparty"
                    }
                  },
                  "required": [
                    "request_id",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "413": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "422": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Aggiorna con controllo versione; sostituisce dati interamente",
        "operationId": "rubrica_patch_detail",
        "security": [
          {
            "bearer": []
          }
        ],
        "x-required-scope": "rubrica:write",
        "parameters": [
          {
            "in": "path",
            "name": "operator_id",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^op_[a-f0-9]{32}$"
            }
          },
          {
            "in": "path",
            "name": "counterparty_id",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^ctp_[a-f0-9]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Esito locale",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store, private"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Counterparty"
                    }
                  },
                  "required": [
                    "request_id",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "413": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "422": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Update"
              }
            }
          }
        }
      }
    },
    "/api/v1/operators/{operator_id}/controparti/{counterparty_id}/compilazione": {
      "get": {
        "summary": "Copia un frammento per il nuovo FIR, senza creare FIR",
        "operationId": "rubrica_get_compile",
        "security": [
          {
            "bearer": []
          }
        ],
        "x-required-scope": "rubrica:read",
        "parameters": [
          {
            "in": "path",
            "name": "operator_id",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^op_[a-f0-9]{32}$"
            }
          },
          {
            "in": "path",
            "name": "counterparty_id",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^ctp_[a-f0-9]{32}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Esito locale",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "const": "no-store, private"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Compiled"
                    }
                  },
                  "required": [
                    "request_id",
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "413": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "422": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Richiesta rifiutata. 401 chiave non valida; 403 scope/contesto; 404 scheda non visibile; 409 duplicato, versione o inattiva; 413 oltre16KiB; 422 formato; 503 funzione disabilitata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    }
                  },
                  "required": [
                    "request_id",
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "CarrierData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "denominazione": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "codice_fiscale": {
            "type": "string",
            "minLength": 5,
            "maxLength": 20
          },
          "nazione_id": {
            "type": "string",
            "minLength": 2,
            "maxLength": 2
          },
          "num_iscr_sito": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "sito": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "rentri_site_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              }
            },
            "required": [
              "rentri_site_id"
            ]
          },
          "numero_iscrizione_albo": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 250,
            "minLength": 1
          },
          "tipo_trasporto": {
            "enum": [
              "terrestre",
              "ferroviario",
              "marittimo"
            ]
          }
        },
        "required": [
          "denominazione"
        ]
      },
      "DestinationData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "denominazione": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "codice_fiscale": {
            "type": "string",
            "minLength": 5,
            "maxLength": 20
          },
          "nazione_id": {
            "type": "string",
            "minLength": 2,
            "maxLength": 2
          },
          "num_iscr_sito": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "sito": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "rentri_site_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              }
            },
            "required": [
              "rentri_site_id"
            ]
          },
          "numero_iscrizione_albo": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 250,
            "minLength": 1
          },
          "indirizzo": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "codice_comune": {
                "type": "string",
                "minLength": 1,
                "maxLength": 250
              },
              "via": {
                "type": "string",
                "minLength": 1,
                "maxLength": 250
              },
              "numero": {
                "type": "string",
                "minLength": 1,
                "maxLength": 250
              },
              "cap": {
                "type": "string",
                "minLength": 1,
                "maxLength": 250
              },
              "citta": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "comune_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 250
                  },
                  "nazione_id": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 2
                  }
                },
                "required": [
                  "comune_id"
                ]
              },
              "indirizzo": {
                "type": "string",
                "minLength": 1,
                "maxLength": 250
              },
              "civico": {
                "type": "string",
                "minLength": 1,
                "maxLength": 250
              }
            }
          },
          "autorizzazione": {
            "anyOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "numero": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 250
                  },
                  "tipo": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 250
                  }
                },
                "required": [
                  "numero",
                  "tipo"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "attivita": {
            "enum": [
              "R1",
              "R2",
              "R3",
              "R4",
              "R5",
              "R6",
              "R7",
              "R8",
              "R9",
              "R10",
              "R11",
              "R12",
              "R13",
              "D1",
              "D2",
              "D3",
              "D4",
              "D5",
              "D6",
              "D7",
              "D8",
              "D9",
              "D10",
              "D11",
              "D12",
              "D13",
              "D14",
              "D15",
              null
            ]
          }
        },
        "required": [
          "denominazione"
        ]
      },
      "IntermediaryData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "denominazione": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "codice_fiscale": {
            "type": "string",
            "minLength": 5,
            "maxLength": 20
          },
          "nazione_id": {
            "type": "string",
            "minLength": 2,
            "maxLength": 2
          },
          "num_iscr_sito": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "sito": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "rentri_site_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              }
            },
            "required": [
              "rentri_site_id"
            ]
          },
          "numero_iscrizione_albo": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 250,
            "minLength": 1
          }
        },
        "required": [
          "denominazione"
        ]
      },
      "Create": {
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "codice": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,79}$"
              },
              "tipo": {
                "const": "transporter"
              },
              "etichetta": {
                "type": "string",
                "minLength": 1,
                "maxLength": 150
              },
              "dati": {
                "$ref": "#/components/schemas/CarrierData"
              }
            },
            "required": [
              "codice",
              "tipo",
              "dati"
            ]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "codice": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,79}$"
              },
              "tipo": {
                "const": "destination"
              },
              "etichetta": {
                "type": "string",
                "minLength": 1,
                "maxLength": 150
              },
              "dati": {
                "$ref": "#/components/schemas/DestinationData"
              }
            },
            "required": [
              "codice",
              "tipo",
              "dati"
            ]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "codice": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,79}$"
              },
              "tipo": {
                "const": "intermediary"
              },
              "etichetta": {
                "type": "string",
                "minLength": 1,
                "maxLength": 150
              },
              "dati": {
                "$ref": "#/components/schemas/IntermediaryData"
              }
            },
            "required": [
              "codice",
              "tipo",
              "dati"
            ]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "codice": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,79}$"
              },
              "tipo": {
                "const": "producer"
              },
              "etichetta": {
                "type": "string",
                "minLength": 1,
                "maxLength": 150
              },
              "dati": {
                "$ref": "#/components/schemas/ProducerData"
              }
            },
            "required": [
              "codice",
              "tipo",
              "dati"
            ]
          }
        ]
      },
      "Counterparty": {
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^ctp_[a-f0-9]{32}$"
              },
              "operator_id": {
                "type": "string",
                "pattern": "^op_[a-f0-9]{32}$"
              },
              "codice": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,79}$"
              },
              "tipo": {
                "const": "transporter"
              },
              "etichetta": {
                "type": "string",
                "minLength": 1,
                "maxLength": 150
              },
              "dati": {
                "$ref": "#/components/schemas/CarrierData"
              },
              "attiva": {
                "type": "boolean"
              },
              "versione": {
                "type": "integer",
                "minimum": 1
              },
              "creata_il": {
                "type": "string",
                "format": "date-time"
              },
              "aggiornata_il": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "id",
              "operator_id",
              "codice",
              "tipo",
              "etichetta",
              "dati",
              "attiva",
              "versione",
              "creata_il",
              "aggiornata_il"
            ]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^ctp_[a-f0-9]{32}$"
              },
              "operator_id": {
                "type": "string",
                "pattern": "^op_[a-f0-9]{32}$"
              },
              "codice": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,79}$"
              },
              "tipo": {
                "const": "destination"
              },
              "etichetta": {
                "type": "string",
                "minLength": 1,
                "maxLength": 150
              },
              "dati": {
                "$ref": "#/components/schemas/DestinationData"
              },
              "attiva": {
                "type": "boolean"
              },
              "versione": {
                "type": "integer",
                "minimum": 1
              },
              "creata_il": {
                "type": "string",
                "format": "date-time"
              },
              "aggiornata_il": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "id",
              "operator_id",
              "codice",
              "tipo",
              "etichetta",
              "dati",
              "attiva",
              "versione",
              "creata_il",
              "aggiornata_il"
            ]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^ctp_[a-f0-9]{32}$"
              },
              "operator_id": {
                "type": "string",
                "pattern": "^op_[a-f0-9]{32}$"
              },
              "codice": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,79}$"
              },
              "tipo": {
                "const": "intermediary"
              },
              "etichetta": {
                "type": "string",
                "minLength": 1,
                "maxLength": 150
              },
              "dati": {
                "$ref": "#/components/schemas/IntermediaryData"
              },
              "attiva": {
                "type": "boolean"
              },
              "versione": {
                "type": "integer",
                "minimum": 1
              },
              "creata_il": {
                "type": "string",
                "format": "date-time"
              },
              "aggiornata_il": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "id",
              "operator_id",
              "codice",
              "tipo",
              "etichetta",
              "dati",
              "attiva",
              "versione",
              "creata_il",
              "aggiornata_il"
            ]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^ctp_[a-f0-9]{32}$"
              },
              "operator_id": {
                "type": "string",
                "pattern": "^op_[a-f0-9]{32}$"
              },
              "codice": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,79}$"
              },
              "tipo": {
                "const": "producer"
              },
              "etichetta": {
                "type": "string",
                "minLength": 1,
                "maxLength": 150
              },
              "dati": {
                "$ref": "#/components/schemas/ProducerData"
              },
              "attiva": {
                "type": "boolean"
              },
              "versione": {
                "type": "integer",
                "minimum": 1
              },
              "creata_il": {
                "type": "string",
                "format": "date-time"
              },
              "aggiornata_il": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "id",
              "operator_id",
              "codice",
              "tipo",
              "etichetta",
              "dati",
              "attiva",
              "versione",
              "creata_il",
              "aggiornata_il"
            ]
          }
        ]
      },
      "Update": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "versione": {
            "type": "integer",
            "minimum": 1
          },
          "etichetta": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "attiva": {
            "type": "boolean"
          },
          "dati": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CarrierData"
              },
              {
                "$ref": "#/components/schemas/DestinationData"
              },
              {
                "$ref": "#/components/schemas/IntermediaryData"
              },
              {
                "$ref": "#/components/schemas/ProducerData"
              }
            ]
          }
        },
        "required": [
          "versione"
        ],
        "minProperties": 2
      },
      "Compiled": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "controparte_id": {
            "type": "string"
          },
          "versione": {
            "type": "integer"
          },
          "tipo": {
            "enum": [
              "transporter",
              "destination",
              "intermediary",
              "producer"
            ]
          },
          "utilizzabile": {
            "type": "boolean"
          },
          "motivo": {
            "enum": [
              null,
              "dati_incompleti_o_non_validi"
            ]
          },
          "frammento_documento": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": false,
            "properties": {
              "destinatario": {
                "$ref": "#/components/schemas/DestinationData"
              },
              "trasportatori": {
                "type": "array",
                "minItems": 1,
                "maxItems": 1,
                "items": {
                  "$ref": "#/components/schemas/CarrierData"
                }
              },
              "intermediari": {
                "type": "array",
                "minItems": 1,
                "maxItems": 1,
                "items": {
                  "$ref": "#/components/schemas/IntermediaryData"
                }
              },
              "produttore": {
                "$ref": "#/components/schemas/ProducerData"
              }
            }
          },
          "validazione_fir_richiesta": {
            "const": true
          },
          "verificata_in_rentri": {
            "const": false
          }
        },
        "required": [
          "controparte_id",
          "versione",
          "tipo",
          "utilizzabile",
          "motivo",
          "frammento_documento",
          "validazione_fir_richiesta",
          "verificata_in_rentri"
        ]
      },
      "ProducerData": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "denominazione": {
            "type": "string",
            "minLength": 1,
            "maxLength": 150
          },
          "codice_fiscale": {
            "type": "string",
            "minLength": 5,
            "maxLength": 20
          },
          "nazione_id": {
            "type": "string",
            "minLength": 2,
            "maxLength": 2
          },
          "num_iscr_sito": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "sito": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "rentri_site_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              }
            },
            "required": [
              "rentri_site_id"
            ]
          },
          "numero_iscrizione_albo": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 250,
            "minLength": 1
          },
          "indirizzo": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "codice_comune": {
                "type": "string",
                "minLength": 1,
                "maxLength": 250
              },
              "via": {
                "type": "string",
                "minLength": 1,
                "maxLength": 250
              },
              "numero": {
                "type": "string",
                "minLength": 1,
                "maxLength": 250
              },
              "cap": {
                "type": "string",
                "minLength": 1,
                "maxLength": 250
              },
              "citta": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "comune_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 250
                  },
                  "nazione_id": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 2
                  }
                },
                "required": [
                  "comune_id"
                ]
              },
              "indirizzo": {
                "type": "string",
                "minLength": 1,
                "maxLength": 250
              },
              "civico": {
                "type": "string",
                "minLength": 1,
                "maxLength": 250
              }
            }
          },
          "autorizzazione": {
            "anyOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "numero": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 250
                  },
                  "tipo": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 250
                  }
                },
                "required": [
                  "numero",
                  "tipo"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "luogo_produzione": {
            "anyOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "codice_comune": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 250
                  },
                  "via": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 250
                  },
                  "numero": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 250
                  },
                  "cap": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 250
                  },
                  "citta": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "comune_id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 250
                      },
                      "nazione_id": {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 2
                      }
                    },
                    "required": [
                      "comune_id"
                    ]
                  },
                  "indirizzo": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 250
                  },
                  "civico": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 250
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "detentore": {
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "required": [
          "denominazione"
        ]
      }
    }
  },
  "x-native-environments": [
    "demo",
    "prod"
  ]
}
