---
import Layout from '@layouts/Layout.astro';
import RegisterForm from '@components/auth/RegisterForm.astro';
import { authService } from '@/lib/authService';

// Получаем глобальные настройки сайта из PocketBase
const pb = authService.createClientFromRequest(Astro.request);
const siteSettings = await pb.collection('site_settings').getFirstListItem('');
const siteUrl = siteSettings.site_url;

// Получаем данные страницы из PocketBase
const pageData = await pb.collection('pages').getFirstListItem('slug = "register"');
const title = `${pageData.title} | ${siteSettings.site_name}`;
const description = pageData.meta_description;
const canonicalLink = pageData.canonical_url ? pageData.canonical_url : `${siteUrl}/${pageData.slug}`;
---

<Layout {title} {description} {canonicalLink}>
    <div class="register-container">
        <h1 class="sr-only">Registrieren bei Berlin Minivan Transfers</h1>
        <RegisterForm />
    </div>
</Layout>