import { z } from "zod";

export const IdeaTagsSchema = z.object({
  category: z.enum([
    "dining", "outdoor", "entertainment", "shopping", "sports",
    "culture", "relaxation", "experience", "nature",
  ]),
  timeSlot: z.enum(["morning", "afternoon", "evening", "flexible", "all_day"]),
  estimatedMinutes: z.number().int().positive(),
  costLevel: z.enum(["free", "budget", "moderate", "premium"]),
  intensity: z.enum(["chill", "moderate", "active"]),
  needsBooking: z.boolean(),
  searchQuery: z.string().min(1),
  searchType: z.enum(["brand", "place", "category"]),
});

export type IdeaTagsSchema = z.infer<typeof IdeaTagsSchema>;

export const SuggestIdeasSchema = z.object({
  suggestions: z.array(z.string()),
});

export const PlanItemSchema = z.object({
  time: z.string(),
  activity: z.string(),
  poi: z.string(),
  address: z.string(),
  lat: z.number(),
  lng: z.number(),
  duration: z.number(),
  reason: z.string(),
  transitToNext: z.number().optional(),
  transitDescription: z.string().optional(),
});

export const GenerateScheduleSchema = z.object({
  items: z.array(PlanItemSchema).min(1),
  summary: z.string(),
});

export const RefinePlanSchema = z.object({
  days: z.array(
    z.object({
      date: z.string(),
      items: z.array(z.record(z.string(), z.unknown())),
    }),
  ).min(1),
});

export const SuggestAlternativesSchema = z.object({
  alternatives: z.array(
    z.object({
      activity: z.string(),
      searchQuery: z.string(),
      reason: z.string().optional(),
    }),
  ),
});
