<script setup lang="ts">
import PageIndex from '@/components/PageIndex.vue'
import type { HomeNewsItem, HomePageModel, HomeQuickItem } from '@/composables/page-drivers/useHomePage'

defineProps<{
  page: HomePageModel
  selectedNews: HomeNewsItem | null
}>()

const emit = defineEmits<{
  news: [item: HomeNewsItem]
  'message-center': []
  quick: [item: HomeQuickItem]
}>()

const isNewsDialogOpen = defineModel<boolean>('newsDialogOpen', { default: false })
</script>

<template>
  <PageIndex
    v-model:is-news-dialog-open="isNewsDialogOpen"
    :news-items="page.newsItems"
    :quick-items="page.quickItems"
    :selected-news="selectedNews"
    @message-center="emit('message-center')"
    @news="emit('news', $event)"
    @quick="emit('quick', $event)"
  />
</template>
