{
  "openapi": "3.1.0",
  "info": {
    "title": "Trips Made Yours Actions",
    "description": "Lädt, erstellt und aktualisiert ausschließlich die Reisevorlagen des über OAuth angemeldeten Trips-Made-Yours-Kontos. Notizen, Screenshots, Buchungsreferenzen und Einladungscodes werden nicht an den Assistenten übertragen.",
    "version": "2.0.0",
    "license": {
      "name": "Private use",
      "url": "https://tripsmadeyours.com"
    }
  },
  "servers": [
    {
      "url": "https://tripsmadeyours.com"
    }
  ],
  "security": [
    {
      "tripsMadeYoursOAuth": ["email"]
    }
  ],
  "paths": {
    "/api/gpt/list-trips": {
      "post": {
        "operationId": "listTrips",
        "summary": "Verfügbare Reisen auflisten",
        "description": "Immer zuerst aufrufen, wenn keine eindeutige Reise-ID aus dem aktuellen Gespräch bekannt ist.",
        "x-openai-isConsequential": false,
        "responses": {
          "200": {
            "description": "Liste der Reisen",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListTripsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/api/gpt/get-trip": {
      "post": {
        "operationId": "getTrip",
        "summary": "Aktuelle Vorlage einer Reise laden",
        "description": "Vor jeder Änderung einer vorhandenen Reise aufrufen. Die zurückgegebenen IDs unveränderter Elemente müssen erhalten bleiben.",
        "x-openai-isConsequential": false,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["tripId"],
                "properties": {
                  "tripId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "ID aus listTrips"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Aktuelle Reisevorlage",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TripResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/api/gpt/create-trip": {
      "post": {
        "operationId": "createTrip",
        "summary": "Neue Reise erstellen",
        "description": "Erst nach ausdrücklicher Bestätigung des Benutzers aufrufen. Erstellt eine neue gemeinsame Reise aus einer vollständigen Vorlage.",
        "x-openai-isConsequential": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TripWriteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Neu erstellte Reise",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TripResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/api/gpt/update-trip": {
      "post": {
        "operationId": "updateTrip",
        "summary": "Bestehende Reisevorlage aktualisieren",
        "description": "Erst nach ausdrücklicher Bestätigung des Benutzers aufrufen. Bereits auf der Website gespeicherte Planungswerte bleiben anhand stabiler IDs erhalten.",
        "x-openai-isConsequential": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TripUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Aktualisierte Reise",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TripResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    }
  },
  "components": {
    "responses": {
      "Unauthorized": {
        "description": "Fehlende, ungültige oder abgelaufene OAuth-Anmeldung",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "required": ["error"],
              "properties": {
                "error": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "securitySchemes": {
      "tripsMadeYoursOAuth": {
        "type": "oauth2",
        "description": "Nutzerbezogene Anmeldung mit dem eigenen Trips-Made-Yours-Konto",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://bzjadcgudorpxcukmmzj.supabase.co/auth/v1/oauth/authorize",
            "tokenUrl": "https://bzjadcgudorpxcukmmzj.supabase.co/auth/v1/oauth/token",
            "scopes": {
              "email": "Konto identifizieren und ausschließlich die eigenen bzw. gemeinsam freigegebenen Reisen laden"
            }
          }
        }
      }
    },
    "schemas": {
      "ListTripsResponse": {
        "type": "object",
        "required": ["trips", "message"],
        "properties": {
          "trips": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TripSummary"
            }
          },
          "message": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "TripResponse": {
        "type": "object",
        "required": ["trip", "message"],
        "properties": {
          "trip": {
            "$ref": "#/components/schemas/TripDetail"
          },
          "message": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "TripSummary": {
        "type": "object",
        "required": ["id", "title", "startDate", "endDate", "role", "canEditTemplate", "websiteUrl"],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "startDate": {
            "type": "string",
            "format": "date"
          },
          "endDate": {
            "type": "string",
            "format": "date"
          },
          "role": {
            "type": "string"
          },
          "canEditTemplate": {
            "type": "boolean"
          },
          "websiteUrl": {
            "type": "string",
            "format": "uri"
          }
        },
        "additionalProperties": false
      },
      "TripDetail": {
        "type": "object",
        "required": ["id", "title", "startDate", "endDate", "role", "canEditTemplate", "template", "websiteUrl"],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "startDate": {
            "type": "string",
            "format": "date"
          },
          "endDate": {
            "type": "string",
            "format": "date"
          },
          "role": {
            "type": "string"
          },
          "canEditTemplate": {
            "type": "boolean"
          },
          "template": {
            "$ref": "#/components/schemas/TripTemplate"
          },
          "websiteUrl": {
            "type": "string",
            "format": "uri"
          }
        },
        "additionalProperties": false
      },
      "TripWriteRequest": {
        "type": "object",
        "required": ["title", "startDate", "endDate", "template"],
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "startDate": {
            "type": "string",
            "format": "date"
          },
          "endDate": {
            "type": "string",
            "format": "date"
          },
          "template": {
            "$ref": "#/components/schemas/TripTemplate"
          }
        },
        "additionalProperties": false
      },
      "TripUpdateRequest": {
        "type": "object",
        "required": ["tripId", "title", "startDate", "endDate", "template"],
        "properties": {
          "tripId": {
            "type": "string",
            "format": "uuid",
            "description": "ID aus listTrips oder getTrip"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "startDate": {
            "type": "string",
            "format": "date"
          },
          "endDate": {
            "type": "string",
            "format": "date"
          },
          "template": {
            "$ref": "#/components/schemas/TripTemplate"
          }
        },
        "additionalProperties": false
      },
      "TripTemplate": {
        "type": "object",
        "required": [
          "schemaVersion",
          "templateId",
          "title",
          "startDate",
          "endDate",
          "currency",
          "people",
          "meta",
          "flight",
          "car",
          "route",
          "destinations",
          "cars",
          "activities",
          "budget",
          "checklist",
          "sources"
        ],
        "properties": {
          "schemaVersion": {
            "type": "integer",
            "enum": [1]
          },
          "templateId": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,63}$"
          },
          "title": {
            "type": "string",
            "maxLength": 100
          },
          "startDate": {
            "type": "string",
            "format": "date"
          },
          "endDate": {
            "type": "string",
            "format": "date"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "people": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          },
          "flight": {
            "$ref": "#/components/schemas/Flight"
          },
          "car": {
            "$ref": "#/components/schemas/Car"
          },
          "route": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RouteStop"
            }
          },
          "destinations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Destination"
            }
          },
          "cars": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CarOption"
            }
          },
          "activities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ActivityGroup"
            }
          },
          "budget": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BudgetItem"
            }
          },
          "checklist": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChecklistItem"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Source"
            }
          }
        },
        "additionalProperties": true
      },
      "Meta": {
        "type": "object",
        "required": [
          "brand",
          "heroImage",
          "heroEyebrow",
          "heroTitle",
          "heroSummary",
          "heroMeta",
          "calloutTitle",
          "calloutText",
          "alternativeLabel",
          "routeTitle",
          "routeIntro",
          "transportTitle",
          "transportIntro",
          "accommodationTitle",
          "accommodationIntro",
          "activitiesTitle",
          "activitiesIntro",
          "budgetIntro",
          "budgetSummary"
        ],
        "properties": {
          "brand": { "type": "string" },
          "heroImage": { "type": "string" },
          "heroEyebrow": { "type": "string" },
          "heroTitle": { "type": "string" },
          "heroSummary": { "type": "string" },
          "heroMeta": {
            "type": "array",
            "items": { "type": "string" }
          },
          "calloutTitle": { "type": "string" },
          "calloutText": { "type": "string" },
          "alternativeLabel": { "type": "string" },
          "routeTitle": { "type": "string" },
          "routeIntro": { "type": "string" },
          "transportTitle": { "type": "string" },
          "transportIntro": { "type": "string" },
          "accommodationTitle": { "type": "string" },
          "accommodationIntro": { "type": "string" },
          "activitiesTitle": { "type": "string" },
          "activitiesIntro": { "type": "string" },
          "budgetIntro": { "type": "string" },
          "budgetSummary": { "type": "string" }
        },
        "additionalProperties": true
      },
      "Flight": {
        "type": "object",
        "required": ["badge", "title", "description", "facts", "links", "defaultPrice"],
        "properties": {
          "badge": { "type": "string" },
          "title": { "type": "string" },
          "description": { "type": "string" },
          "facts": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["label", "value"],
              "properties": {
                "label": { "type": "string" },
                "value": { "type": "string" }
              },
              "additionalProperties": false
            }
          },
          "links": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["label", "url"],
              "properties": {
                "label": { "type": "string" },
                "url": { "type": "string" }
              },
              "additionalProperties": false
            }
          },
          "defaultPrice": { "type": "number", "minimum": 0 }
        },
        "additionalProperties": true
      },
      "Car": {
        "type": "object",
        "required": ["badge", "title", "description", "defaultPrice"],
        "properties": {
          "badge": { "type": "string" },
          "title": { "type": "string" },
          "description": { "type": "string" },
          "defaultPrice": { "type": "number", "minimum": 0 }
        },
        "additionalProperties": true
      },
      "RouteStop": {
        "type": "object",
        "required": ["id", "place", "dates", "nights", "coords", "drive", "note"],
        "properties": {
          "id": { "$ref": "#/components/schemas/StableId" },
          "place": { "type": "string" },
          "dates": { "type": "string" },
          "nights": { "type": "integer", "minimum": 0 },
          "coords": {
            "type": "array",
            "minItems": 2,
            "maxItems": 2,
            "items": { "type": "number" }
          },
          "drive": { "type": "string" },
          "note": { "type": "string" }
        },
        "additionalProperties": true
      },
      "Destination": {
        "type": "object",
        "required": ["id", "name", "dates", "nights", "vibe", "image", "imageCredit", "bookingDates", "hotels"],
        "properties": {
          "id": { "$ref": "#/components/schemas/StableId" },
          "name": { "type": "string" },
          "dates": { "type": "string" },
          "nights": { "type": "integer", "minimum": 0 },
          "vibe": { "type": "string" },
          "image": { "type": "string" },
          "imageCredit": { "type": "string" },
          "bookingDates": {
            "type": "array",
            "minItems": 2,
            "maxItems": 2,
            "items": { "type": "string", "format": "date" }
          },
          "hotels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Hotel"
            }
          }
        },
        "additionalProperties": true
      },
      "Hotel": {
        "type": "object",
        "required": ["id", "name", "tier", "desc", "tags", "official", "maps"],
        "properties": {
          "id": { "$ref": "#/components/schemas/StableId" },
          "name": { "type": "string" },
          "tier": { "type": "string" },
          "badge": { "type": "string" },
          "desc": { "type": "string" },
          "tags": {
            "type": "array",
            "items": { "type": "string" }
          },
          "official": { "type": "string" },
          "maps": { "type": "string" }
        },
        "additionalProperties": true
      },
      "CarOption": {
        "type": "object",
        "required": ["id", "name", "detail", "link"],
        "properties": {
          "id": { "$ref": "#/components/schemas/StableId" },
          "name": { "type": "string" },
          "detail": { "type": "string" },
          "link": { "type": "string" }
        },
        "additionalProperties": true
      },
      "ActivityGroup": {
        "type": "object",
        "required": ["group", "items"],
        "properties": {
          "group": { "type": "string" },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Activity"
            }
          }
        },
        "additionalProperties": true
      },
      "Activity": {
        "type": "object",
        "required": ["id", "title", "detail"],
        "properties": {
          "id": { "$ref": "#/components/schemas/StableId" },
          "title": { "type": "string" },
          "detail": { "type": "string" },
          "link": { "type": "string" }
        },
        "additionalProperties": true
      },
      "BudgetItem": {
        "type": "object",
        "required": ["id", "label", "hint", "value"],
        "properties": {
          "id": { "$ref": "#/components/schemas/StableId" },
          "label": { "type": "string" },
          "hint": { "type": "string" },
          "value": { "type": "number", "minimum": 0 }
        },
        "additionalProperties": true
      },
      "ChecklistItem": {
        "type": "object",
        "required": ["id", "label", "detail"],
        "properties": {
          "id": { "$ref": "#/components/schemas/StableId" },
          "label": { "type": "string" },
          "detail": { "type": "string" }
        },
        "additionalProperties": true
      },
      "Source": {
        "type": "object",
        "required": ["title", "text", "link"],
        "properties": {
          "title": { "type": "string" },
          "text": { "type": "string" },
          "link": { "type": "string" }
        },
        "additionalProperties": false
      },
      "StableId": {
        "type": "string",
        "pattern": "^[a-z0-9][a-z0-9-]{0,63}$",
        "description": "Stabile technische ID. Bei Änderungen vorhandener Elemente unverändert lassen."
      }
    }
  }
}
