'use client';

import * as React from 'react';
import { Page as PDFPage } from '@react-pdf/renderer';
import { FoldingMarks, Header, Footer, pdfStyles } from './SharedUI';

interface DINLayoutProps {
    children: React.ReactNode;
    sender?: string;
    recipient?: {
        title: string;
        subtitle?: string;
        address?: string;
        phone?: string;
        email?: string;
        taxId?: string;
    };
    icon?: string;
    footerLogo?: string;
    companyData: any;
    bankData: any;
    showAddress?: boolean;
    showFooterDetails?: boolean;
}

export const DINLayout = ({
    children,
    sender,
    recipient,
    icon,
    footerLogo,
    companyData,
    bankData,
    showAddress = true,
    showFooterDetails = true
}: DINLayoutProps) => {
    return (
        <PDFPage size="A4" style={pdfStyles.page}>
            <FoldingMarks />
            <Header
                sender={sender}
                recipient={recipient}
                icon={icon}
                showAddress={showAddress}
            />
            {children}
            <Footer
                logo={footerLogo}
                companyData={companyData}
                bankData={bankData}
                showDetails={showFooterDetails}
            />
        </PDFPage>
    );
};
