'use client';

import React, { ReactNode } from 'react';
import styles from './PageWrapper.module.scss';

interface PageWrapperProps {
    children: ReactNode;
    className?: string;
    withRow?: boolean; // Se true, adiciona row e col12
    /** @deprecated Breadcrumbs removidos do produto; prop ignorada. */
    showBreadcrumb?: boolean;
    /** @deprecated Breadcrumbs removidos do produto; prop ignorada. */
    breadcrumbItems?: Array<{ title: string; path?: string }>;
    /** Sem padding lateral no mobile (ex.: /dashboard edge-to-edge) */
    bleedMobile?: boolean;
    'data-testid'?: string;
}

export default function PageWrapper({
    children,
    className = '',
    withRow = true,
    bleedMobile = false,
    'data-testid': dataTestId,
}: PageWrapperProps) {
    const wrapperClass = `${styles.wrapper}${bleedMobile ? ` ${styles.wrapperBleedMobile}` : ''} ${className}`.trim();
    const content = <>{children}</>;

    if (withRow) {
        return (
            <div className={wrapperClass} data-testid={dataTestId} data-fvar-content-root>
                <div className={styles.row}>
                    <div className={styles.col12}>{content}</div>
                </div>
            </div>
        );
    }

    return (
        <div className={wrapperClass} data-testid={dataTestId} data-fvar-content-root>
            {content}
        </div>
    );
}
