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

import Hero from '@components/career/Hero.astro';
import CandidateRequirements from '@components/career/CandidateRequirements.astro';
import CompanyValues from '@components/career/CompanyValues.astro';
import OpenPositions from '@components/career/OpenPositions.astro';
import ApplicationProcess from '@components/career/ApplicationProcess.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 = "karriere"');
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}>
    <Hero />
    <CandidateRequirements />
    <CompanyValues />
    <OpenPositions />
    <ApplicationProcess />
</Layout>