import { SuggestionsConfigForm } from '@/components/modules/suggestions-config-form';
import { SuggestionsListManager } from '@/components/modules/suggestions-list-manager';
import { getLocale, t } from '@/lib/i18n';
import { getSuggestionConfigDashboard, listSuggestions } from '@/lib/module-configs/suggestions';

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

export default async function SuggestionsPage({ params }: SuggestionsPageProps) {
  const { guildId } = await params;
  const [locale, config, suggestions] = await Promise.all([
    getLocale(),
    getSuggestionConfigDashboard(guildId),
    listSuggestions(guildId, { limit: 25 })
  ]);

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