import { Metadata, Viewport } from 'next';
import Layout from '../../layout/layout';
import ProtectedLayout from '../../components/ProtectedLayout';

interface MainLayoutProps {
    children: React.ReactNode;
}

// Force dynamic rendering for all pages in this layout to avoid useSearchParams issues
export const dynamic = 'force-dynamic';
export const dynamicParams = true;

export const metadata: Metadata = {
    title: 'BTP Xpress',
    description: 'Votre plateforme de gestion BTP moderne pour tous vos projets de construction.',
    robots: { index: false, follow: false },
    openGraph: {
        type: 'website',
        title: 'BTP Xpress - Gestion de projets BTP',
        url: 'https://btpxpress.com',
        description: 'Votre plateforme de gestion BTP moderne pour tous vos projets de construction.',
        images: ['https://btpxpress.com/static/social/btpxpress.png'],
        ttl: 604800
    },
    icons: {
        icon: '/favicon.ico'
    }
};

export const viewport: Viewport = {
    initialScale: 1,
    width: 'device-width'
};

export default function MainLayout({ children }: MainLayoutProps) {
    return (
        <ProtectedLayout>
            <Layout>{children}</Layout>
        </ProtectedLayout>
    );
}
