import { notFound } from "next/navigation";

import { GatewaySettingsForm } from "../_components/gateway-form/gateway-settings-form";
import { getGatewayConfig, gatewayIds } from "../_components/gateway-form/configs";

type PageProps = {
  params: Promise<{ gatewayId: string }>;
};

export function generateStaticParams() {
  return gatewayIds.map((gatewayId) => ({ gatewayId }));
}

export default async function PaymentGatewaySettingsPage({ params }: PageProps) {
  const { gatewayId } = await params;
  const config = getGatewayConfig(gatewayId);

  if (!config) {
    notFound();
  }

  return <GatewaySettingsForm config={config} />;
}
