<script setup>
import RequestTrackerView from '~/components/request/RequestTrackerView.vue'
import { buildRequestPageSeo, useRequestContent } from '~/content/request'
import { resolvePrivateFlowToken } from '~/utils/private-flow-route'
import { buildPublicSeoLinks } from '~/utils/public-seo'

const route = useRoute()
const token = computed(() => resolvePrivateFlowToken(route, '/request', 'token'))
const { requestPage } = useRequestContent(token)

const requestPageSeo = computed(() => buildRequestPageSeo(requestPage.value, { privateFlow: true }))

useSeoMeta({
  title: () => requestPageSeo.value.title,
  description: () => requestPageSeo.value.description,
  ogTitle: () => requestPageSeo.value.ogTitle,
  ogDescription: () => requestPageSeo.value.ogDescription,
  robots: () => requestPageSeo.value.robots,
})

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

<template>
  <RequestTrackerView :token="token" />
</template>
