{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/yondry-app/json-schema/yondry-app-planner-request-schema.json",
  "title": "PlannerRequest",
  "description": "Request body for POST /planner/query.",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/yondry-app-openapi.json#/components/schemas/PlannerRequest",
  "properties": {
    "query": {
      "type": "string",
      "maxLength": 500,
      "minLength": 1,
      "title": "Query"
    },
    "origin_lat": {
      "anyOf": [
        {
          "type": "number",
          "maximum": 90.0,
          "minimum": -90.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Origin Lat"
    },
    "origin_lon": {
      "anyOf": [
        {
          "type": "number",
          "maximum": 180.0,
          "minimum": -180.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Origin Lon"
    },
    "origin_label": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 120
        },
        {
          "type": "null"
        }
      ],
      "title": "Origin Label"
    },
    "radius_km": {
      "type": "number",
      "maximum": 200.0,
      "exclusiveMinimum": 0.0,
      "title": "Radius Km",
      "default": 20.0
    },
    "departure_time": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Departure Time"
    },
    "travel_mode": {
      "type": "string",
      "pattern": "^(driving|walking|cycling)$",
      "title": "Travel Mode",
      "default": "driving"
    },
    "optimize_for_return": {
      "type": "boolean",
      "title": "Optimize For Return",
      "default": true
    },
    "vibes": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Vibes"
    },
    "companion": {
      "type": "string",
      "title": "Companion",
      "default": "solo"
    },
    "must_include_places": {
      "items": {
        "$ref": "#/$defs/MustIncludePlace"
      },
      "type": "array",
      "title": "Must Include Places"
    },
    "prefer_discovery": {
      "type": "boolean",
      "title": "Prefer Discovery",
      "default": false
    },
    "discovery_weight": {
      "anyOf": [
        {
          "type": "number",
          "maximum": 1.0,
          "minimum": 0.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Discovery Weight"
    },
    "zone_lat": {
      "anyOf": [
        {
          "type": "number",
          "maximum": 90.0,
          "minimum": -90.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Zone Lat"
    },
    "zone_lon": {
      "anyOf": [
        {
          "type": "number",
          "maximum": 180.0,
          "minimum": -180.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Zone Lon"
    },
    "zone_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Zone Name"
    },
    "previous_plan": {
      "anyOf": [
        {
          "$ref": "#/$defs/Plan"
        },
        {
          "type": "null"
        }
      ]
    },
    "previous_plan_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Previous Plan Id"
    },
    "follow_up_query": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 500,
          "minLength": 1
        },
        {
          "type": "null"
        }
      ],
      "title": "Follow Up Query"
    },
    "timezone": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 64
        },
        {
          "type": "null"
        }
      ],
      "title": "Timezone"
    },
    "language": {
      "type": "string",
      "maxLength": 20,
      "minLength": 2,
      "title": "Language",
      "default": "en"
    },
    "campaign_slug": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 100
        },
        {
          "type": "null"
        }
      ],
      "title": "Campaign Slug"
    },
    "anchor_place_id": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 200
        },
        {
          "type": "null"
        }
      ],
      "title": "Anchor Place Id"
    }
  },
  "type": "object",
  "required": [
    "query"
  ],
  "$defs": {
    "AlternativeStop": {
      "properties": {
        "name": {
          "type": "string",
          "title": "Name"
        },
        "category": {
          "type": "string",
          "title": "Category"
        },
        "why": {
          "type": "string",
          "title": "Why"
        }
      },
      "type": "object",
      "required": [
        "name",
        "category",
        "why"
      ],
      "title": "AlternativeStop",
      "description": "A backup option suggested alongside a primary plan stop."
    },
    "JourneySegment": {
      "properties": {
        "from_location": {
          "type": "string",
          "title": "From Location"
        },
        "to_location": {
          "type": "string",
          "title": "To Location"
        },
        "mode": {
          "type": "string",
          "title": "Mode"
        },
        "minutes": {
          "type": "integer",
          "title": "Minutes"
        },
        "depart_time": {
          "type": "string",
          "format": "date-time",
          "title": "Depart Time"
        }
      },
      "type": "object",
      "required": [
        "from_location",
        "to_location",
        "mode",
        "minutes",
        "depart_time"
      ],
      "title": "JourneySegment",
      "description": "Arrival or return leg between the user's start location and the destination zone."
    },
    "MustIncludePlace": {
      "properties": {
        "name": {
          "type": "string",
          "title": "Name"
        },
        "category": {
          "type": "string",
          "title": "Category"
        },
        "lat": {
          "type": "number",
          "title": "Lat"
        },
        "lon": {
          "type": "number",
          "title": "Lon"
        },
        "google_place_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Google Place Id"
        },
        "is_free": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Is Free"
        }
      },
      "type": "object",
      "required": [
        "name",
        "category",
        "lat",
        "lon"
      ],
      "title": "MustIncludePlace",
      "description": "A place the user explicitly wants included in every generated plan."
    },
    "Plan": {
      "properties": {
        "label": {
          "type": "string",
          "title": "Label"
        },
        "stops": {
          "items": {
            "$ref": "#/$defs/PlanStop"
          },
          "type": "array",
          "title": "Stops"
        },
        "summary": {
          "type": "string",
          "title": "Summary"
        },
        "conflicts": {
          "items": {
            "$ref": "#/$defs/PlanningConflictOut"
          },
          "type": "array",
          "title": "Conflicts"
        },
        "total_duration_mins": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Total Duration Mins"
        },
        "plan_notes": {
          "type": "string",
          "title": "Plan Notes",
          "default": ""
        },
        "arrival_segment": {
          "anyOf": [
            {
              "$ref": "#/$defs/JourneySegment"
            },
            {
              "type": "null"
            }
          ]
        },
        "return_segment": {
          "anyOf": [
            {
              "$ref": "#/$defs/JourneySegment"
            },
            {
              "type": "null"
            }
          ]
        },
        "buffer_minutes": {
          "type": "integer",
          "title": "Buffer Minutes",
          "default": 20
        },
        "travel_note": {
          "type": "string",
          "title": "Travel Note",
          "default": ""
        }
      },
      "type": "object",
      "required": [
        "label",
        "stops",
        "summary"
      ],
      "title": "Plan",
      "description": "One complete itinerary option returned by Claude Sonnet."
    },
    "PlanStop": {
      "properties": {
        "place_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Place Id"
        },
        "name": {
          "type": "string",
          "title": "Name"
        },
        "category": {
          "type": "string",
          "title": "Category"
        },
        "why": {
          "type": "string",
          "title": "Why"
        },
        "suggested_duration_minutes": {
          "type": "integer",
          "title": "Suggested Duration Minutes"
        },
        "is_discovery": {
          "type": "boolean",
          "title": "Is Discovery",
          "default": false
        },
        "is_meal": {
          "type": "boolean",
          "title": "Is Meal",
          "default": false
        },
        "lat": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Lat"
        },
        "lng": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Lng"
        },
        "admission_price": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Admission Price"
        },
        "alternative_stops": {
          "items": {
            "$ref": "#/$defs/AlternativeStop"
          },
          "type": "array",
          "title": "Alternative Stops"
        },
        "travel_leg": {
          "anyOf": [
            {
              "$ref": "#/$defs/TravelLegOut"
            },
            {
              "type": "null"
            }
          ]
        },
        "arrival_time": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Arrival Time"
        },
        "transition_to_next": {
          "anyOf": [
            {
              "$ref": "#/$defs/TransitionSegment"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "type": "object",
      "required": [
        "name",
        "category",
        "why",
        "suggested_duration_minutes"
      ],
      "title": "PlanStop",
      "description": "A single stop in an NL-generated plan."
    },
    "PlanningConflictOut": {
      "properties": {
        "type": {
          "type": "string",
          "title": "Type"
        },
        "stop_name": {
          "type": "string",
          "title": "Stop Name"
        },
        "detail": {
          "type": "string",
          "title": "Detail"
        },
        "suggestion": {
          "type": "string",
          "title": "Suggestion"
        }
      },
      "type": "object",
      "required": [
        "type",
        "stop_name",
        "detail",
        "suggestion"
      ],
      "title": "PlanningConflictOut"
    },
    "TransitionSegment": {
      "properties": {
        "mode": {
          "type": "string",
          "title": "Mode"
        },
        "minutes": {
          "type": "integer",
          "title": "Minutes"
        },
        "distance_km": {
          "type": "number",
          "title": "Distance Km"
        },
        "is_estimated": {
          "type": "boolean",
          "title": "Is Estimated",
          "default": true
        }
      },
      "type": "object",
      "required": [
        "mode",
        "minutes",
        "distance_km"
      ],
      "title": "TransitionSegment",
      "description": "Travel segment between two consecutive stops within the zone."
    },
    "TravelLegOut": {
      "properties": {
        "from_stop": {
          "type": "string",
          "title": "From Stop"
        },
        "to_stop": {
          "type": "string",
          "title": "To Stop"
        },
        "distance_km": {
          "type": "number",
          "title": "Distance Km"
        },
        "travel_mins": {
          "type": "integer",
          "title": "Travel Mins"
        },
        "travel_mode": {
          "type": "string",
          "title": "Travel Mode"
        }
      },
      "type": "object",
      "required": [
        "from_stop",
        "to_stop",
        "distance_km",
        "travel_mins",
        "travel_mode"
      ],
      "title": "TravelLegOut"
    }
  }
}