import { SelfRolesManager } from '@/components/modules/selfroles-manager';
import { getLocale, t } from '@/lib/i18n';
import { listSelfRolePanels } from '@/lib/module-configs/selfroles';

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

export default async function SelfRolesPage({ params }: SelfRolesPageProps) {
  const { guildId } = await params;
  const [locale, panels] = await Promise.all([getLocale(), listSelfRolePanels(guildId)]);

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