{
  "openapi": "3.1.0",
  "info": {
    "title": "TRX Spearguns Public API",
    "version": "1.0.0",
    "description": "API pubblica in sola lettura con i dati di TRX Spearguns: informazioni aziendali, catalogo di fucili subacquei e accessori, articoli del blog. Nessuna autenticazione.",
    "contact": {
      "name": "TRX Spearguns",
      "email": "info@gibarsub.it",
      "url": "https://trxspearguns.com/contact"
    }
  },
  "servers": [
    {
      "url": "https://trxspearguns.com"
    }
  ],
  "externalDocs": {
    "description": "Documentazione per sviluppatori",
    "url": "https://trxspearguns.com/docs"
  },
  "paths": {
    "/api/v1/info": {
      "get": {
        "operationId": "getBusinessInfo",
        "summary": "Informazioni aziendali",
        "description": "Restituisce nome, contatti, indirizzo, P.IVA, modalita' d'ordine e pagine principali di TRX Spearguns.",
        "tags": [
          "business"
        ],
        "responses": {
          "200": {
            "description": "Informazioni aziendali.",
            "headers": {
              "RateLimit-Policy": {
                "description": "Politica di rate limit (IETF draft): 60 richieste ogni 60 secondi per IP.",
                "schema": {
                  "type": "string",
                  "example": "\"default\";q=60;w=60"
                }
              },
              "RateLimit": {
                "description": "Richieste rimanenti (r) e secondi al reset (t) nella finestra corrente.",
                "schema": {
                  "type": "string",
                  "example": "\"default\";r=59;t=60"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BusinessInfo"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit superato.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/products": {
      "get": {
        "operationId": "listProducts",
        "summary": "Elenco prodotti",
        "description": "Restituisce il catalogo completo (fucili e accessori) con prezzo in euro, specifiche e link alla scheda. Filtrabile per categoria.",
        "tags": [
          "catalog"
        ],
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "required": false,
            "description": "Filtra per categoria.",
            "schema": {
              "type": "string",
              "enum": [
                "Arbalete",
                "Accessori"
              ]
            }
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "description": "Lingua dei testi: it (predefinita) o en.",
            "schema": {
              "type": "string",
              "enum": [
                "it",
                "en"
              ],
              "default": "it"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Lista prodotti.",
            "headers": {
              "RateLimit-Policy": {
                "description": "Politica di rate limit (IETF draft): 60 richieste ogni 60 secondi per IP.",
                "schema": {
                  "type": "string",
                  "example": "\"default\";q=60;w=60"
                }
              },
              "RateLimit": {
                "description": "Richieste rimanenti (r) e secondi al reset (t) nella finestra corrente.",
                "schema": {
                  "type": "string",
                  "example": "\"default\";r=59;t=60"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductList"
                }
              }
            }
          },
          "400": {
            "description": "Parametro non valido.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit superato.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/products/{id}": {
      "get": {
        "operationId": "getProduct",
        "summary": "Dettaglio prodotto",
        "description": "Restituisce un singolo prodotto dato il suo id (es. trx-carbon-80).",
        "tags": [
          "catalog"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Id del prodotto, ottenibile da listProducts.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9-]{1,80}$",
              "example": "trx-carbon-80"
            }
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "description": "Lingua dei testi: it (predefinita) o en.",
            "schema": {
              "type": "string",
              "enum": [
                "it",
                "en"
              ],
              "default": "it"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Prodotto.",
            "headers": {
              "RateLimit-Policy": {
                "description": "Politica di rate limit (IETF draft): 60 richieste ogni 60 secondi per IP.",
                "schema": {
                  "type": "string",
                  "example": "\"default\";q=60;w=60"
                }
              },
              "RateLimit": {
                "description": "Richieste rimanenti (r) e secondi al reset (t) nella finestra corrente.",
                "schema": {
                  "type": "string",
                  "example": "\"default\";r=59;t=60"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Product"
                }
              }
            }
          },
          "400": {
            "description": "Parametro non valido.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Prodotto inesistente.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit superato.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/blog": {
      "get": {
        "operationId": "listBlogPosts",
        "summary": "Articoli del blog",
        "description": "Restituisce gli articoli del blog (guide sulla pesca in apnea e sulla scelta del fucile) con titolo, estratto, data e URL.",
        "tags": [
          "content"
        ],
        "responses": {
          "200": {
            "description": "Lista articoli.",
            "headers": {
              "RateLimit-Policy": {
                "description": "Politica di rate limit (IETF draft): 60 richieste ogni 60 secondi per IP.",
                "schema": {
                  "type": "string",
                  "example": "\"default\";q=60;w=60"
                }
              },
              "RateLimit": {
                "description": "Richieste rimanenti (r) e secondi al reset (t) nella finestra corrente.",
                "schema": {
                  "type": "string",
                  "example": "\"default\";r=59;t=60"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BlogPostList"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit superato.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Address": {
        "type": "object",
        "required": [
          "streetAddress",
          "postalCode",
          "addressLocality",
          "addressCountry"
        ],
        "properties": {
          "streetAddress": {
            "type": "string"
          },
          "postalCode": {
            "type": "string"
          },
          "addressLocality": {
            "type": "string"
          },
          "addressRegion": {
            "type": "string"
          },
          "addressCountry": {
            "type": "string",
            "description": "Codice ISO 3166-1 alpha-2."
          }
        }
      },
      "BusinessInfo": {
        "type": "object",
        "required": [
          "name",
          "description",
          "url",
          "email",
          "telephone",
          "address"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "logo": {
            "type": "string",
            "format": "uri"
          },
          "founder": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "telephone": {
            "type": "string"
          },
          "vatId": {
            "type": "string"
          },
          "address": {
            "$ref": "#/components/schemas/Address"
          },
          "languages": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "shipping": {
            "type": "string"
          },
          "ordering": {
            "type": "string"
          },
          "sameAs": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            }
          },
          "pages": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "format": "uri"
            }
          }
        }
      },
      "Product": {
        "type": "object",
        "required": [
          "id",
          "name",
          "category",
          "description",
          "price",
          "currency",
          "url",
          "image"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "enum": [
              "Arbalete",
              "Accessori"
            ]
          },
          "description": {
            "type": "string"
          },
          "price": {
            "type": [
              "number",
              "null"
            ],
            "description": "Prezzo in euro, IVA inclusa."
          },
          "currency": {
            "type": "string",
            "const": "EUR"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "image": {
            "type": "string",
            "format": "uri"
          },
          "features": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "specifications": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "included": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "ProductList": {
        "type": "object",
        "required": [
          "count",
          "lang",
          "products"
        ],
        "properties": {
          "count": {
            "type": "integer"
          },
          "lang": {
            "type": "string",
            "enum": [
              "it",
              "en"
            ]
          },
          "products": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Product"
            }
          }
        }
      },
      "BlogPost": {
        "type": "object",
        "required": [
          "slug",
          "title",
          "excerpt",
          "date",
          "url"
        ],
        "properties": {
          "slug": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "excerpt": {
            "type": "string"
          },
          "date": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "readingTime": {
            "type": "integer",
            "description": "Minuti di lettura."
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "BlogPostList": {
        "type": "object",
        "required": [
          "count",
          "posts"
        ],
        "properties": {
          "count": {
            "type": "integer"
          },
          "posts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BlogPost"
            }
          }
        }
      },
      "Problem": {
        "type": "object",
        "description": "Errore in formato RFC 9457 (application/problem+json).",
        "required": [
          "type",
          "title",
          "status",
          "detail",
          "code"
        ],
        "properties": {
          "type": {
            "type": "string",
            "format": "uri"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "resolution": {
            "type": "string"
          }
        }
      }
    }
  }
}