import { SliderForm } from "@/components/dashboard/slider-form"
import { createClient } from "@/lib/supabase-server"
import { notFound } from "next/navigation"

interface EditSliderPageProps {
    params: {
        id: string
    }
}

export default async function EditSliderPage({ params }: EditSliderPageProps) {
    const supabase = createClient()

    const { data: slider } = await supabase
        .from('sliders')
        .select('*')
        .eq('id', params.id)
        .single()

    if (!slider) {
        notFound()
    }

    return (
        <div className="flex-1 space-y-4 p-8 pt-6">
            <div className="flex items-center justify-between space-y-2">
                <h2 className="text-3xl font-bold tracking-tight">Slider Düzenle</h2>
            </div>
            <div className="max-w-2xl">
                <SliderForm initialData={slider} />
            </div>
        </div>
    )
}
