<script setup>
import SearchCatalogView from '~/components/search/SearchCatalogView.vue'
import { buildSearchPageSeo, useSearchContent } from '~/content/search'
import { buildPublicSeoLinks } from '~/utils/public-seo'

definePageMeta({
  pageTransition: {
    name: 'rent-flow',
    mode: 'out-in',
  },
})

const { searchPage } = useSearchContent()
const runtimeConfig = useRuntimeConfig()
const pageOrigin = computed(() => String(runtimeConfig.public.siteBaseUrl || '').replace(/\/+$/, ''))
const searchPageSeo = computed(() => buildSearchPageSeo(searchPage.value, pageOrigin.value))

useSeoMeta({
  title: () => searchPageSeo.value.title,
  description: () => searchPageSeo.value.description,
  ogTitle: () => searchPageSeo.value.ogTitle,
  ogDescription: () => searchPageSeo.value.ogDescription,
  ogImage: () => searchPageSeo.value.ogImage || undefined,
  robots: () => searchPageSeo.value.robots,
})

useHead(() => ({
  link: buildPublicSeoLinks(searchPageSeo.value),
}))
</script>

<template>
  <SearchCatalogView />
</template>
