<script setup lang="ts">
// Components
import PaginationView from '~/components/pub/my-ui/pagination/pagination-view.vue'

// Types
import type { SepVisitData } from './list-cfg.visit'
import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'

// Configs
import { config } from './list-cfg.history'

const props = defineProps<{
  data: SepVisitData[]
  paginationMeta?: PaginationMeta
}>()

const emit = defineEmits<{
  pageChange: [page: number]
}>()

function handlePageChange(page: number) {
  emit('pageChange', page)
}
</script>

<template>
  <PubMyUiDataTable
    v-bind="config"
    :rows="props.data"
  />
  <PaginationView
    v-if="paginationMeta"
    :pagination-meta="paginationMeta"
    @page-change="handlePageChange"
  />
</template>
