import type { Metadata } from 'next';
import { IntegrationDetailContent } from './integration-detail-content';
import type { IntegrationType } from '@/types/integrations';

interface IntegrationDetailPageProps {
  params: {
    locale: string;
    type: string;
  };
}

const integrationTitles: Record<string, string> = {
  plentyone: 'PlentyONE',
  zulip: 'ZULIP',
  todoist: 'Todoist',
  freescout: 'FreeScout',
  nextcloud: 'Nextcloud',
  ecodms: 'ecoDMS',
};

export async function generateMetadata({
  params,
}: IntegrationDetailPageProps): Promise<Metadata> {
  const title = integrationTitles[params.type] || 'Integration';
  return {
    title: `${title} | Integrationen | tOS`,
    description: `${title} Integration verwalten`,
  };
}

/**
 * Dynamic integration detail page
 */
export default function IntegrationDetailPage({ params }: IntegrationDetailPageProps) {
  return (
    <IntegrationDetailContent
      locale={params.locale}
      integrationType={params.type as IntegrationType}
    />
  );
}
