<script setup lang="ts">
import { t } from '../i18n'

defineProps<{
  page: number
  pageSize: number
  total: number
}>()

const emit = defineEmits<{
  next: []
  prev: []
}>()
</script>

<template>
  <div class="pagination">
    <button class="btn" :disabled="page <= 1" @click="emit('prev')">{{ t('previous') }}</button>
    <span>{{ t('page') }} {{ page }} / {{ Math.max(Math.ceil(total / pageSize), 1) }}</span>
    <button class="btn" :disabled="page >= Math.ceil(total / pageSize)" @click="emit('next')">{{ t('next') }}</button>
  </div>
</template>
