import { LangDebugBanner } from '@/components/lang-debug-banner';
import { LocaleRoot } from '@/components/locale-root';
import AuthLayoutTemplate from '@/layouts/auth/auth-simple-layout';
import { useI18n } from '@/hooks/use-i18n';

export default function AuthLayout({
    title = '',
    description = '',
    titleKey,
    descriptionKey,
    children,
}: {
    title?: string;
    description?: string;
    titleKey?: string;
    descriptionKey?: string;
    children: React.ReactNode;
}) {
    const { t } = useI18n();
    const resolvedTitle = titleKey !== undefined && titleKey !== '' ? t(titleKey) : title;
    const resolvedDescription =
        descriptionKey !== undefined && descriptionKey !== '' ? t(descriptionKey) : description;

    return (
        <LocaleRoot>
            <AuthLayoutTemplate title={resolvedTitle} description={resolvedDescription}>
                <div className="p-6">{children}</div>
            </AuthLayoutTemplate>
            <LangDebugBanner />
        </LocaleRoot>
    );
}
