import { ModuleTogglesForm } from '@/components/settings/module-toggles-form';
import { getLocale, t } from '@/lib/i18n';
import { getModuleStatuses } from '@/lib/modules';

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

export default async function GuildModulesPage({ params }: ModulesPageProps) {
  const { guildId } = await params;
  const [locale, statuses] = await Promise.all([getLocale(), getModuleStatuses(guildId)]);

  return (
    <div className="space-y-6">
      <div>
        <h1 className="text-2xl font-semibold">{t(locale, 'modulesPage.title')}</h1>
        <p className="text-sm text-muted-foreground">{t(locale, 'modulesPage.description')}</p>
      </div>
      <ModuleTogglesForm guildId={guildId} initialStatuses={statuses} />
    </div>
  );
}
