'use client';

import * as React from 'react';
import { Page as PDFPage, View as PDFView, Text as PDFText, StyleSheet } from '@react-pdf/renderer';
import { Header, Footer, pdfStyles } from './SharedUI.js';

const simpleStyles = StyleSheet.create({
    industrialPage: {
        padding: 30,
        paddingTop: 20,
        backgroundColor: '#ffffff',
    },
    industrialNumber: {
        fontSize: 60,
        fontWeight: 'bold',
        color: '#f1f5f9',
        position: 'absolute',
        top: -10,
        right: 0,
        zIndex: -1,
    },
    industrialSection: {
        marginTop: 16,
        paddingTop: 12,
        flexDirection: 'row',
        position: 'relative',
    },
});

interface SimpleLayoutProps {
    children: React.ReactNode;
    pageNumber?: string;
    icon?: string;
    footerLogo?: string;
    companyData: any;
    bankData?: any;
    showPageNumber?: boolean;
}

export const SimpleLayout = ({
    children,
    pageNumber,
    icon,
    footerLogo,
    companyData,
    bankData,
    showPageNumber = true
}: SimpleLayoutProps) => {
    return (
        <PDFPage size="A4" style={[pdfStyles.page, simpleStyles.industrialPage]}>
            <Header icon={icon} showAddress={false} />
            {pageNumber && <PDFText style={simpleStyles.industrialNumber}>{pageNumber}</PDFText>}
            <PDFView style={simpleStyles.industrialSection}>
                <PDFView style={{ width: '100%' }}>
                    {children}
                </PDFView>
            </PDFView>
            <Footer
                logo={footerLogo}
                companyData={companyData}
                bankData={bankData}
                showDetails={false}
                showPageNumber={showPageNumber}
            />
        </PDFPage>
    );
};
