import { RootLayout, handleServerFunctions } from '@payloadcms/next/layouts';
import type { ServerFunctionClient } from 'payload';
import React from 'react';
import config from '../../payload.config';
import { importMap } from './gestion59/importMap';

export default function AdminLayout({ children }: { children: React.ReactNode }) {
  const serverFunction: ServerFunctionClient = async (args) => {
    'use server';
    return handleServerFunctions({
      ...args,
      config,
      importMap,
    });
  };

  return RootLayout({
    config,
    importMap,
    serverFunction,
    children,
  });
}
