import {
  Music,
  Sparkles,
  PartyPopper,
  Trophy,
  Theater,
  Laugh,
  GraduationCap,
  Briefcase,
  UtensilsCrossed,
  Baby,
  Globe,
  Church,
  Heart,
  Handshake,
  Car,
  Shirt,
  Gamepad2,
  Film,
  Mountain,
  Calendar,
  Flag,
  type LucideIcon,
} from "lucide-react"

export interface EventCategory {
  value: string
  label: string
  icon: LucideIcon
  description: string
  color: string
  mainCategory: string // Added main category grouping
}

export const MAIN_CATEGORIES = [
  { value: "entertainment", label: "Entertainment", icon: Music },
  { value: "sports_adventure", label: "Sports & Adventure", icon: Trophy },
  { value: "arts_culture", label: "Arts & Culture", icon: Theater },
  { value: "food_lifestyle", label: "Food & Lifestyle", icon: UtensilsCrossed },
  { value: "business_education", label: "Business & Education", icon: Briefcase },
  { value: "community", label: "Community", icon: Globe },
  { value: "special_events", label: "Special Events", icon: Calendar },
] as const

export const EVENT_CATEGORIES: EventCategory[] = [
  {
    value: "music_concerts",
    label: "Music Concerts",
    icon: Music,
    description: "Live music performances and concerts",
    color: "text-purple-600 bg-purple-100 dark:bg-purple-900/20",
    mainCategory: "entertainment",
  },
  {
    value: "festivals",
    label: "Festivals",
    icon: Sparkles,
    description: "Cultural festivals and celebrations",
    color: "text-pink-600 bg-pink-100 dark:bg-pink-900/20",
    mainCategory: "entertainment",
  },
  {
    value: "parties_nightlife",
    label: "Parties & Nightlife",
    icon: PartyPopper,
    description: "Nightlife events and parties",
    color: "text-indigo-600 bg-indigo-100 dark:bg-indigo-900/20",
    mainCategory: "entertainment",
  },
  {
    value: "sports",
    label: "Sports",
    icon: Trophy,
    description: "Sporting events and competitions",
    color: "text-green-600 bg-green-100 dark:bg-green-900/20",
    mainCategory: "sports_adventure",
  },
  {
    value: "theatre_performing_arts",
    label: "Theatre & Performing Arts",
    icon: Theater,
    description: "Theater productions and performing arts",
    color: "text-red-600 bg-red-100 dark:bg-red-900/20",
    mainCategory: "arts_culture",
  },
  {
    value: "comedy_shows",
    label: "Comedy Shows",
    icon: Laugh,
    description: "Stand-up comedy and humorous performances",
    color: "text-yellow-600 bg-yellow-100 dark:bg-yellow-900/20",
    mainCategory: "entertainment",
  },
  {
    value: "workshops_classes",
    label: "Workshops & Classes",
    icon: GraduationCap,
    description: "Educational workshops and classes",
    color: "text-blue-600 bg-blue-100 dark:bg-blue-900/20",
    mainCategory: "business_education",
  },
  {
    value: "conferences_seminars",
    label: "Conferences & Seminars",
    icon: Briefcase,
    description: "Professional conferences and seminars",
    color: "text-slate-600 bg-slate-100 dark:bg-slate-900/20",
    mainCategory: "business_education",
  },
  {
    value: "food_drink_events",
    label: "Food & Drink Events",
    icon: UtensilsCrossed,
    description: "Culinary experiences and tastings",
    color: "text-orange-600 bg-orange-100 dark:bg-orange-900/20",
    mainCategory: "food_lifestyle",
  },
  {
    value: "family_kids",
    label: "Family & Kids",
    icon: Baby,
    description: "Family-friendly and children's events",
    color: "text-cyan-600 bg-cyan-100 dark:bg-cyan-900/20",
    mainCategory: "community",
  },
  {
    value: "cultural_community",
    label: "Cultural & Community",
    icon: Globe,
    description: "Community gatherings and cultural events",
    color: "text-teal-600 bg-teal-100 dark:bg-teal-900/20",
    mainCategory: "arts_culture",
  },
  {
    value: "religious_faith",
    label: "Religious & Faith-Based",
    icon: Church,
    description: "Religious services and faith gatherings",
    color: "text-violet-600 bg-violet-100 dark:bg-violet-900/20",
    mainCategory: "community",
  },
  {
    value: "charity_fundraisers",
    label: "Charity & Fundraisers",
    icon: Heart,
    description: "Charitable events and fundraising",
    color: "text-rose-600 bg-rose-100 dark:bg-rose-900/20",
    mainCategory: "community",
  },
  {
    value: "business_networking",
    label: "Business & Networking",
    icon: Handshake,
    description: "Professional networking events",
    color: "text-gray-600 bg-gray-100 dark:bg-gray-900/20",
    mainCategory: "business_education",
  },
  {
    value: "car_bike_shows",
    label: "Car & Bike Shows",
    icon: Car,
    description: "Automotive and motorcycle exhibitions",
    color: "text-zinc-600 bg-zinc-100 dark:bg-zinc-900/20",
    mainCategory: "special_events",
  },
  {
    value: "fashion_beauty",
    label: "Fashion & Beauty",
    icon: Shirt,
    description: "Fashion shows and beauty events",
    color: "text-fuchsia-600 bg-fuchsia-100 dark:bg-fuchsia-900/20",
    mainCategory: "food_lifestyle",
  },
  {
    value: "gaming_esports",
    label: "Gaming & eSports",
    icon: Gamepad2,
    description: "Gaming tournaments and eSports",
    color: "text-emerald-600 bg-emerald-100 dark:bg-emerald-900/20",
    mainCategory: "entertainment",
  },
  {
    value: "film_entertainment",
    label: "Film & Entertainment",
    icon: Film,
    description: "Movie screenings and entertainment",
    color: "text-amber-600 bg-amber-100 dark:bg-amber-900/20",
    mainCategory: "entertainment",
  },
  {
    value: "adventure_outdoor",
    label: "Adventure & Outdoor",
    icon: Mountain,
    description: "Outdoor adventures and activities",
    color: "text-lime-600 bg-lime-100 dark:bg-lime-900/20",
    mainCategory: "sports_adventure",
  },
  {
    value: "holiday_seasonal",
    label: "Holiday & Seasonal",
    icon: Calendar,
    description: "Seasonal celebrations and holidays",
    color: "text-sky-600 bg-sky-100 dark:bg-sky-900/20",
    mainCategory: "special_events",
  },
  {
    value: "carnival_parade",
    label: "Carnival & Parade",
    icon: Flag,
    description: "Carnival celebrations and parades",
    color: "text-red-600 bg-red-100 dark:bg-red-900/20",
    mainCategory: "special_events",
  },
]

export function getCategoryByValue(value: string): EventCategory | undefined {
  return EVENT_CATEGORIES.find((cat) => cat.value === value)
}

export function getCategoryLabel(value: string): string {
  return getCategoryByValue(value)?.label || value
}

export function getCategorySlug(label: string): string {
  return label.toLowerCase().replace(/\s+/g, "-").replace(/&/g, "and")
}

export function getCategoryFromSlug(slug: string): EventCategory | undefined {
  return EVENT_CATEGORIES.find((cat) => getCategorySlug(cat.label) === slug)
}
