<script setup lang="ts">
import { ref } from "vue";
import contentConfig from "./config/content.config";
import searchConfig from "./config/search.config";
import { usePageSearch, type PageHooks, type PageEvents } from "/@/hooks/page";
import InvoiceModal from "./components/invoice-modal.vue";
import { useRouter } from "vue-router";

const PageName = "supplyTicketReturnRelive";
const baseUrl = "/supply/supplyTicketReturnReliveDetail";

const { push } = useRouter();

const invoiceModalRef = ref<InstanceType<typeof InvoiceModal>>(null);

const hooks: PageHooks = {
  pageSearchHook: () => usePageSearch(undefined, undefined, searchConfig)
};

const events: PageEvents = {
  content: {
    preview: ({ returnCode }) => push(`${baseUrl}?id=${returnCode}`),
    create: () => push(baseUrl)
  }
};
</script>

<template>
  <PageAuth :pageName="PageName">
    <PageContainer
      :hooks="hooks"
      :events="events"
      :contentConfig="contentConfig"
      :search-config="searchConfig"
    />

    <InvoiceModal ref="invoiceModalRef" />
  </PageAuth>
</template>
