import { List } from "./_components/List";
import { db } from "@/app/_lib/database";
import { serviceConfig } from "@/app/_lib/config";

type PageProps = {
  params: {
    segment: string[];
  };
};

export default async function Page({ params: { segment } }: PageProps) {
  const service = segment[0];

  const config = serviceConfig[service];
  const rows = await db.selectFrom(config.table).selectAll().execute();

  return <List service={service} rows={rows} />;
}
