import { Metadata } from 'next';
import { generateMetadata as createMetadata } from "@/lib/seo/metadata";

// Force dynamic rendering for policy pages
export const dynamic = 'force-dynamic';
export const dynamicParams = true;
export const revalidate = 0;

// Generate metadata for policy pages
// This prevents Next.js from trying to access undefined searchParams during SSR
export async function generateMetadata(): Promise<Metadata> {
  try {
    return createMetadata({
      title: 'Policies - Privacy Policy, Terms of Use & Support Policy',
      description: 'View GNX Soft\'s Privacy Policy, Terms of Use, and Support Policy. Learn about our data protection practices, terms and conditions, and support guidelines.',
      keywords: [
        'Privacy Policy',
        'Terms of Use',
        'Support Policy',
        'Legal Documents',
        'Company Policies',
        'Data Protection',
        'Terms and Conditions',
      ],
      url: '/policy',
    });
  } catch (error) {
    // Fallback metadata if generation fails
    console.error('Error generating metadata for policy page:', error);
    return {
      title: 'Policies | GNX Soft',
      description: 'View GNX Soft\'s Privacy Policy, Terms of Use, and Support Policy.',
    };
  }
}

export default function PolicyLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return <>{children}</>;
}

