import { GiveawaysManager } from '@/components/modules/giveaways-manager';
import { getLocale, t } from '@/lib/i18n';
import { listGiveaways } from '@/lib/module-configs/giveaways';

interface GiveawaysPageProps {
  params: Promise<{ guildId: string }>;
}

export default async function GiveawaysPage({ params }: GiveawaysPageProps) {
  const { guildId } = await params;
  const [locale, giveaways] = await Promise.all([getLocale(), listGiveaways(guildId)]);

  return (
    <div className="space-y-6">
      <div>
        <h1 className="text-2xl font-semibold">{t(locale, 'modules.giveaways.label')}</h1>
        <p className="text-sm text-muted-foreground">{t(locale, 'modules.giveaways.description')}</p>
      </div>
      <GiveawaysManager guildId={guildId} initialGiveaways={giveaways} />
    </div>
  );
}
