import PageContainer from '@/components/layout/page-container';
import { TrainingHeader } from '@/feactures/training/components/training-header';
import TrainingList from '@/feactures/training/components/training-list';
import TrainingTableAction from '@/feactures/training/components/training-tables/training-table-action';
import { searchParamsCache } from '@repo/shadcn/lib/searchparams';
import { SearchParams } from 'nuqs';

import { env } from '@/lib/env';

export const metadata = {
  title: 'Registro de OSP',
};

type PageProps = {
  searchParams: Promise<SearchParams>;
};

export default async function Page({ searchParams }: PageProps) {
  const {
    page,
    q: searchQuery,
    limit,
  } = searchParamsCache.parse(await searchParams);

  return (
    // <PageContainer>
    // <div className="flex flex-1 flex-col space-y-6">
    < div className="p-6 space-y-6" >
      <TrainingHeader />
      <TrainingTableAction />
      <TrainingList
        initialPage={page}
        initialSearch={searchQuery}
        initialLimit={limit || 10}
        apiUrl={env.API_URL}
      />
    </div >
    // </PageContainer>
  );
}
