{
  "openapi": "3.1.0",
  "info": {
    "title": "Veruno Store — agentní nákup (magnet)",
    "description": "Veřejné API pro AI agenty k nákupu v e-shopu (demo magnet, Veruno). Projdi produkty (listProducts), zjisti dopravu (getShippingZones), vytvoř objednávku (createOrder). U karty payment_url pro člověka. Agent neplatí. Bez auth.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://veruno.cz",
      "description": "Veruno (magnet e-shop, demo)"
    }
  ],
  "paths": {
    "/api/v1/magnet/stock/store": {
      "get": {
        "operationId": "listProducts",
        "summary": "Produkty v nabídce",
        "description": "Vrátí produkty e-shopu skladem s cenou. Použij sku při vytváření objednávky.",
        "responses": {
          "200": {
            "description": "Seznam produktů",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "products": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "sku": {
                            "type": "string",
                            "description": "kód produktu — použij v createOrder"
                          },
                          "name": {
                            "type": "string"
                          },
                          "price": {
                            "type": "number"
                          },
                          "in_stock": {
                            "type": "boolean"
                          },
                          "stock_qty": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/magnet/shipping/zones": {
      "get": {
        "operationId": "getShippingZones",
        "summary": "Dopravní zóny a metody",
        "description": "Mapa zóna → země → metody dopravy (s method_id a cenou). Podle země zákazníka vyber method_id pro createOrder. Zavolej jednou před objednávkou.",
        "responses": {
          "200": {
            "description": "Zóny",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "zones": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "zone_name": {
                            "type": "string"
                          },
                          "countries": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "methods": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "method_id": {
                                  "type": "integer"
                                },
                                "method_name": {
                                  "type": "string"
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/store/magnet/": {
      "post": {
        "operationId": "createOrder",
        "summary": "Vytvoření objednávky (bez tokenu)",
        "description": "Vytvoří objednávku. billing.country musí odpovídat dopravní zóně a shipping_method_id té zemi (jinak NO_SHIPPING_ZONE / SHIPPING_METHOD_INVALID s available_methods). U platby kartou vrátí payment_url — předej uživateli, agent neplatí.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "_action",
                  "items",
                  "billing",
                  "shipping_method_id",
                  "payment_method_code"
                ],
                "properties": {
                  "_action": {
                    "type": "string",
                    "enum": [
                      "submit_order"
                    ],
                    "default": "submit_order"
                  },
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "sku",
                        "qty"
                      ],
                      "properties": {
                        "sku": {
                          "type": "string"
                        },
                        "qty": {
                          "type": "integer",
                          "default": 1
                        }
                      }
                    }
                  },
                  "billing": {
                    "type": "object",
                    "required": [
                      "first_name",
                      "last_name",
                      "email",
                      "street",
                      "city",
                      "postal_code",
                      "country"
                    ],
                    "properties": {
                      "first_name": {
                        "type": "string"
                      },
                      "last_name": {
                        "type": "string"
                      },
                      "email": {
                        "type": "string",
                        "format": "email"
                      },
                      "phone": {
                        "type": "string"
                      },
                      "street": {
                        "type": "string"
                      },
                      "city": {
                        "type": "string"
                      },
                      "postal_code": {
                        "type": "string"
                      },
                      "country": {
                        "type": "string",
                        "description": "ISO kód země, např. CZ",
                        "example": "CZ"
                      }
                    }
                  },
                  "shipping_same_as_billing": {
                    "type": "boolean",
                    "default": true
                  },
                  "shipping_method_id": {
                    "type": "integer",
                    "description": "method_id z getShippingZones pro danou zemi"
                  },
                  "payment_method_code": {
                    "type": "string",
                    "enum": [
                      "bank_transfer",
                      "card",
                      "cod"
                    ],
                    "description": "card → vrátí payment_url (předej uživateli); bank_transfer → pokyny k převodu; cod → dobírka"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Objednávka vytvořena (číslo objednávky; u karty payment_url)"
          },
          "400": {
            "description": "Chyba: NO_SHIPPING_ZONE / SHIPPING_METHOD_REQUIRED / SHIPPING_METHOD_INVALID (response má available_methods)"
          }
        },
        "x-openai-isConsequential": false
      }
    }
  }
}