{
  "openapi": "3.1.0",
  "info": {
    "title": "AutoLove.ch Native AI Public API",
    "version": "2027.2.0",
    "description": "Deterministic inventory search, Swiss-to-Poland customs/excise/VAT calculator, Reto Virtual Concierge valuation chat, Dual Vehicle Sourcing Orders, and Swiss Pre-Arrival alert registration."
  },
  "servers": [
    { "url": "https://api.autolove.ch", "description": "Production API" },
    { "url": "http://127.0.0.1:4175", "description": "Local Live API" }
  ],
  "paths": {
    "/api/public/exchange-rate": {
      "get": {
        "operationId": "getLiveDailyNbpChfRate",
        "summary": "Return today's live NBP Table C CHF/PLN exchange-office sell rate (ask) and Table A mid rate (cached daily)",
        "responses": {
          "200": { "description": "JSON object with kantorRate (NBP Table C ask), midRate (NBP Table A mid), tableNo and effectiveDate" }
        }
      }
    },
    "/api/public/listings": {
      "get": {
        "operationId": "getVerifiedSwissListings",
        "summary": "List verified Swiss vehicles ready in Legnica hall or in start-up preparation",
        "responses": {
          "200": { "description": "JSON array of verified vehicles with PLN gross pricing and VIN specs" }
        }
      }
    },
    "/api/public/calculate": {
      "get": {
        "operationId": "calculateSwissImportCostPln",
        "summary": "Calculate exact Polish import costs (CHF conversion, EU duty, AKC-U/S excise, OSKP, 5000 PLN fee, 23% VAT)",
        "parameters": [
          { "name": "chf", "in": "query", "required": true, "schema": { "type": "number", "default": 14500 } },
          { "name": "rate", "in": "query", "required": false, "schema": { "type": "number", "default": 4.88 } },
          { "name": "transport", "in": "query", "required": false, "schema": { "type": "number", "default": 2200 } },
          {
            "name": "drivetrain",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["ice_u20", "ice_o20", "hev_u20", "hev_20_35", "phev_u20", "bev"],
              "default": "hev_u20"
            }
          },
          { "name": "origin", "in": "query", "required": false, "schema": { "type": "string", "enum": ["eu", "non_eu"], "default": "eu" } },
          { "name": "mode", "in": "query", "required": false, "schema": { "type": "string", "enum": ["concierge", "self"], "default": "concierge" } }
        ],
        "responses": {
          "200": { "description": "Deterministic tax and turnkey gross PLN breakdown" }
        }
      }
    },
    "/api/public/reto/chat": {
      "post": {
        "operationId": "askRetoVirtualConcierge",
        "summary": "Conversational Swiss car import valuation and listing analysis with Reto Virtual Concierge",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "threadId": { "type": "string" },
                  "message": { "type": "string" },
                  "lang": { "type": "string", "enum": ["pl", "en", "ch-de"], "default": "pl" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Concierge response, live CHF/PLN import breakdown, and matched verified stock" }
        }
      }
    },
    "/api/public/sourcing-order": {
      "post": {
        "operationId": "submitSwissVehicleSourcingOrder",
        "summary": "Submit a simple or detailed technical custom car sourcing order with optional reference photos",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["budgetPln", "description", "clientName", "clientEmail", "clientPhone", "consent"],
                "properties": {
                  "mode": { "type": "string", "enum": ["simple", "technical"], "default": "simple" },
                  "simpleModel": { "type": "string" },
                  "brand": { "type": "string" },
                  "modelGen": { "type": "string" },
                  "fuelDrive": { "type": "string", "default": "hev_u20" },
                  "budgetPln": { "type": "number" },
                  "budgetChf": { "type": "string" },
                  "description": { "type": "string" },
                  "clientName": { "type": "string" },
                  "clientEmail": { "type": "string", "format": "email" },
                  "clientPhone": { "type": "string" },
                  "consent": { "type": "boolean" },
                  "lang": { "type": "string", "enum": ["pl", "en", "ch-de"], "default": "pl" }
                }
              }
            }
          }
        },
        "responses": {
          "201": { "description": "Sourcing order saved in CRM and confirmation email dispatched" }
        }
      }
    },
    "/api/public/newsletter": {
      "post": {
        "operationId": "subscribeSwissPreArrivalAlerts",
        "summary": "Subscribe buyer email to Pre-Arrival alerts for verified cars still in Switzerland before transport to Poland",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["email", "consent"],
                "properties": {
                  "email": { "type": "string", "format": "email" },
                  "segment": { "type": "string", "enum": ["all", "suv_4x4", "kombi", "hybrid", "sedan_premium"], "default": "all" },
                  "lang": { "type": "string", "enum": ["pl", "en", "ch-de"], "default": "pl" },
                  "consent": { "type": "boolean" }
                }
              }
            }
          }
        },
        "responses": {
          "201": { "description": "Subscription saved in Pre-Arrival dispatch list" }
        }
      }
    }
  }
}
