{
  "openapi": "3.1.0",
  "info": {
    "title": "HITRO — API dla asystentów AI",
    "version": "2026-09-30",
    "description": "Widełki z cennika, link do planu i bezpłatna rezerwacja w imieniu człowieka. Opis i zasady: https://mvp.hitro.cc/agent/schema.json. Strona: https://mvp.hitro.cc/dla-agentow-ai.",
    "contact": {
      "name": "HITRO",
      "url": "https://mvp.hitro.cc",
      "email": "kontakt@hitro.cc"
    }
  },
  "servers": [
    {
      "url": "https://hitro2.onrender.com/api/v1"
    }
  ],
  "paths": {
    "/mvp/agent/schema": {
      "get": {
        "operationId": "hitro_schema",
        "summary": "Opis HITRO, pytania, katalog, zasady",
        "description": "Pobiera opis HITRO: pytania z „po co\", katalog pakietów i dodatków (netto), zasady, linki. Wywołaj raz na początku rozmowy. | Fetches the HITRO description: questions with their rationale, package and add-on catalog (net PLN), rules, links. Call once at the start of a conversation.",
        "responses": {
          "200": {
            "description": "Schemat",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/mvp/agent/estimate": {
      "post": {
        "operationId": "hitro_estimate",
        "summary": "Widełki z cennika + link do planu",
        "description": "Liczy widełki netto/brutto z cennika HITRO dla konfiguracji i zwraca link do planu (/plan). Cena liczona na serwerze — nie licz jej sam. | Computes the net/gross price range from the HITRO price list for a configuration and returns a plan link (/plan). Priced on the server — do not compute it yourself.",
        "requestBody": {
          "required": true,
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentConfig"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Widełki",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EstimateResponse"
                }
              }
            }
          },
          "400": {
            "description": "Błędna konfiguracja",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/mvp/agent/plan": {
      "post": {
        "operationId": "hitro_plan",
        "summary": "Widełki + kroki po rezerwacji",
        "description": "To samo co estimate plus kroki po rezerwacji, trzy rzeczy, o które poprosi tracker, i lista tego, co HITRO ustala za człowieka. | Same as estimate plus the post-reservation steps, the three things the tracker will ask for, and what HITRO decides on the person's behalf.",
        "requestBody": {
          "required": true,
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentConfig"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Plan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlanResponse"
                }
              }
            }
          },
          "400": {
            "description": "Błędna konfiguracja",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/mvp/agent/reserve": {
      "post": {
        "operationId": "hitro_reserve",
        "summary": "Bezpłatna rezerwacja w imieniu człowieka (wymaga consent: true)",
        "description": "Składa BEZPŁATNĄ rezerwację (0 zł) w imieniu człowieka. Asystent MUSI najpierw pokazać człowiekowi kwotę (lowNet/lowGross) i zapytać o zgodę; consent: true tylko po jego wyraźnym „tak\". Zwraca link do trackera i PIN — przekaż je człowiekowi, nie zapisuj PIN-u. | Places a FREE reservation (0 PLN) on behalf of the person. The assistant MUST first show the person the amount (lowNet/lowGross) and ask for consent; set consent: true only after an explicit \"yes\". Returns a tracker link and PIN — hand them to the person, do not store the PIN.",
        "requestBody": {
          "required": true,
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReserveRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Rezerwacja złożona",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReserveResponse"
                }
              }
            }
          },
          "400": {
            "description": "Brak zgody, zły e-mail/telefon lub pusta konfiguracja",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Limit rezerwacji z jednego adresu",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AgentConfig": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "photos": {
            "type": "integer",
            "minimum": 0,
            "maximum": 5,
            "default": 0,
            "description": "Liczba sesji zdjęciowych (od 249 zł netto)"
          },
          "reels": {
            "type": "integer",
            "minimum": 0,
            "maximum": 5,
            "default": 0,
            "description": "Liczba rolek 60 s (960 zł netto)"
          },
          "films": {
            "type": "integer",
            "minimum": 0,
            "maximum": 5,
            "default": 0,
            "description": "Liczba filmów 90 s (od 4 900 zł netto)"
          },
          "city": {
            "type": "string",
            "enum": [
              "wroclaw",
              "poza"
            ],
            "default": "wroclaw",
            "description": "Miejsce zdjęć: Wrocław i okolice albo poza Wrocławiem (dojazd wyceniany osobno)."
          },
          "rush": {
            "type": "boolean",
            "default": false,
            "description": "Ekspres 48 h (dotyczy sztuk wideo)."
          },
          "secondLocation": {
            "type": "boolean",
            "default": false,
            "description": "Zdjęcia w dwóch miejscach tego samego dnia."
          },
          "description": {
            "type": "string",
            "maxLength": 600,
            "description": "Zadanie jednym zdaniem, słowami człowieka."
          },
          "addons": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "brand-voice",
                "makeup",
                "wiecej-ujec",
                "format-extra",
                "extra-runda"
              ]
            },
            "uniqueItems": true,
            "description": "Dodatki opcjonalne wybrane przez człowieka (id z katalogu)."
          },
          "preferredDate": {
            "type": "string",
            "format": "date",
            "description": "Preferowany dzień zdjęć RRRR-MM-DD, dziś lub później, do roku naprzód (propozycja, do potwierdzenia)."
          },
          "location": {
            "type": "string",
            "enum": [
              "hitro",
              "own"
            ],
            "default": "hitro",
            "description": "Kto daje miejsce zdjęć."
          },
          "locationNote": {
            "type": "string",
            "maxLength": 160,
            "description": "Notatka o własnym miejscu (tylko przy location=own)."
          }
        }
      },
      "EstimateLine": {
        "type": "object",
        "required": [
          "id",
          "label",
          "qty",
          "unitNet",
          "totalNet",
          "kind"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "qty": {
            "type": "integer"
          },
          "unitNet": {
            "type": "number"
          },
          "totalNet": {
            "type": "number"
          },
          "kind": {
            "type": "string",
            "enum": [
              "base",
              "addon"
            ]
          }
        }
      },
      "EstimateResponse": {
        "type": "object",
        "required": [
          "valid",
          "itemsCount",
          "lowNet",
          "highNet",
          "lowGross",
          "highGross",
          "baseLines",
          "optionalLines",
          "recommendedPackageId",
          "leadDays",
          "notes",
          "planUrl"
        ],
        "properties": {
          "valid": {
            "type": "boolean",
            "description": "false, gdy konfiguracja nie ma żadnej sztuki."
          },
          "itemsCount": {
            "type": "integer"
          },
          "lowNet": {
            "type": "number",
            "description": "Dół widełek netto: pakiety + dodatki wybrane przez człowieka."
          },
          "highNet": {
            "type": "number",
            "description": "Góra widełek netto: dół + dodatki opcjonalne."
          },
          "lowGross": {
            "type": "number"
          },
          "highGross": {
            "type": "number"
          },
          "baseLines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EstimateLine"
            }
          },
          "optionalLines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EstimateLine"
            }
          },
          "recommendedPackageId": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "sesja",
              "rolka-60s",
              "film-90s",
              null
            ]
          },
          "leadDays": {
            "type": "integer",
            "description": "Dni od dnia zdjęć do plików."
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "planUrl": {
            "type": "string",
            "format": "uri",
            "description": "Link do /plan z tą konfiguracją — do przekazania człowiekowi."
          }
        }
      },
      "PlanResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/EstimateResponse"
          },
          {
            "type": "object",
            "required": [
              "steps",
              "asks",
              "decided"
            ],
            "properties": {
              "steps": {
                "type": "array",
                "description": "Co się dzieje po rezerwacji, krok po kroku (rezerwacja → telefon → płatność → zdjęcia → pliki → poprawki).",
                "items": {
                  "type": "object",
                  "required": [
                    "id",
                    "title",
                    "body",
                    "when"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "body": {
                      "type": "string"
                    },
                    "when": {
                      "type": "string"
                    }
                  }
                }
              },
              "asks": {
                "type": "array",
                "description": "Trzy rzeczy, o które tracker poprosi człowieka po rezerwacji.",
                "items": {
                  "type": "object",
                  "required": [
                    "id",
                    "label",
                    "why"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "label": {
                      "type": "string"
                    },
                    "why": {
                      "type": "string"
                    }
                  }
                }
              },
              "decided": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Co HITRO ustala za człowieka (ekipa, sprzęt, formaty, harmonogram)."
              }
            }
          }
        ]
      },
      "ReserveRequest": {
        "type": "object",
        "required": [
          "config",
          "contact",
          "consent"
        ],
        "additionalProperties": false,
        "properties": {
          "config": {
            "$ref": "#/components/schemas/AgentConfig"
          },
          "contact": {
            "type": "object",
            "required": [
              "fullName",
              "email",
              "phone"
            ],
            "additionalProperties": false,
            "properties": {
              "fullName": {
                "type": "string",
                "minLength": 2,
                "maxLength": 120
              },
              "email": {
                "type": "string",
                "format": "email"
              },
              "phone": {
                "type": "string",
                "minLength": 9,
                "maxLength": 32,
                "description": "Co najmniej 9 cyfr — opiekun projektu dzwoni."
              },
              "company": {
                "type": "string",
                "maxLength": 160
              }
            }
          },
          "consent": {
            "type": "boolean",
            "const": true,
            "description": "Człowiek wprost zgodził się na bezpłatną rezerwację w swoim imieniu. Bez true serwer odrzuca żądanie."
          },
          "agent": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "name": {
                "type": "string",
                "maxLength": 80
              },
              "version": {
                "type": "string",
                "maxLength": 40
              }
            },
            "description": "Nazwa asystenta (do logów, bez danych człowieka)."
          }
        }
      },
      "ReserveResponse": {
        "type": "object",
        "required": [
          "orderId",
          "pin",
          "trackerUrl",
          "planUrl",
          "totalNet",
          "totalGross",
          "message"
        ],
        "properties": {
          "orderId": {
            "type": "string"
          },
          "pin": {
            "type": "string",
            "description": "PIN do trackera — należy do człowieka. Przekaż, nie zapisuj."
          },
          "trackerUrl": {
            "type": "string",
            "format": "uri"
          },
          "planUrl": {
            "type": "string",
            "format": "uri"
          },
          "totalNet": {
            "type": "number",
            "description": "Kwota rezerwacji netto (dół widełek)."
          },
          "totalGross": {
            "type": "number"
          },
          "message": {
            "type": "string",
            "description": "Instrukcja przekazania człowiekowi (link + PIN, telefon opiekuna)."
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "integer"
          },
          "message": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ]
          },
          "error": {
            "type": "string"
          }
        }
      }
    }
  }
}
