import { SchedulerManager } from '@/components/modules/scheduler-manager';
import { getLocale, t } from '@/lib/i18n';
import { listScheduledMessagesDashboard } from '@/lib/module-configs/scheduler';

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

export default async function SchedulerPage({ params }: SchedulerPageProps) {
  const { guildId } = await params;
  const [locale, schedules] = await Promise.all([getLocale(), listScheduledMessagesDashboard(guildId)]);

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