"use client"

import { useProgram } from "@/client/program"
import { useQuizzes } from "@/client/quiz"
import { getDefaultLayout, IDefaultLayoutPage, IPageHeader } from "@/components/layout/default-layout"
import ListPanel from "@/components/program/ListPanel"
import Preview from "@/components/program/Preview"
import SearchPanel from "@/components/program/SearchPanel"
import { useRouter } from "next/router"

const pageHeader: IPageHeader = {
  title: "퀴즈 Preview",
}

const Index: IDefaultLayoutPage = () => {
  const router = useRouter()
  const pid = router.query.pid as string

  const { data: program } = useProgram({ id: pid })
  const { data } = useQuizzes({
    program_id: pid,
  })

  return <Preview program={program} quizzes={data?.data} />
}

Index.getLayout = getDefaultLayout
Index.pageHeader = pageHeader

export default Index
