import { sitePreferencesService } from "@/services/preferences/site-preferences.service";
import BackgroundPreferences from "@/components/admin/BackgroundPreferences";
import EventPointsPreferences from "@/components/admin/EventPointsPreferences";
import EventFeedbackPointsPreferences from "@/components/admin/EventFeedbackPointsPreferences";
import HousePointsPreferences from "@/components/admin/HousePointsPreferences";
import { Card } from "@/components/ui";

export const dynamic = "force-dynamic";

export default async function AdminPreferencesPage() {
  const sitePreferences =
    await sitePreferencesService.getOrCreateSitePreferences();

  return (
    <Card variant="dark" className="p-4 sm:p-6">
      <div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-6">
        <h2 className="text-xl sm:text-2xl font-gaming font-bold text-pixel-gold break-words">
          Préférences UI Globales
        </h2>
      </div>
      <div className="space-y-4">
        <BackgroundPreferences initialPreferences={sitePreferences} />
        <EventPointsPreferences initialPreferences={sitePreferences} />
        <EventFeedbackPointsPreferences initialPreferences={sitePreferences} />
        <HousePointsPreferences initialPreferences={sitePreferences} />
      </div>
    </Card>
  );
}

