import { createClient } from '@/lib/supabase/server'
import { NewRoundWizard } from '@/components/round/new-round-wizard'

type Tee = {
  id: string
  name: string
  color: string
  course_rating: number
  slope_rating: number
}

type Course = {
  id: string
  name: string
  par: number
  tees: Tee[]
}

export default async function NewRoundPage() {
  const supabase = await createClient()
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  const { data: courses } = await (supabase as any)
    .from('courses')
    .select('id, name, par, tees(id, name, color, course_rating, slope_rating)')
    .order('name')

  return <NewRoundWizard courses={(courses as Course[]) ?? []} />
}
