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

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

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

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

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

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

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