---
import Layout from '@layouts/Layout.astro';

import Hero from '@components/partner/Hero.astro';
import Benefits from '@components/partner/Benefits.astro';
import TargetAudience from '@components/partner/TargetAudience.astro';
import HowItWorks from '@components/partner/HowItWorks.astro';
import CTA from '@components/partner/CTA.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 = "partner"');
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={title} description={description} canonicalLink={canonicalLink}>
    <div class="min-h-screen">
        <Hero />
        <Benefits />
        <TargetAudience />
        <HowItWorks />
        <CTA />
    </div>
</Layout>