<script setup lang="ts">
import { usePageSearch } from "/@/components/PageSearch";
import searchConfig from "./config/search.config";
import contentConfig from "./config/content.config";
import PageAuth from "/@/components/PageAuth";
import { PageModal, usePageModal } from "/@/components/PageModal";
import modalConfig from "./config/modal.config";
import { useRouter } from "vue-router";
import PageContainer, {
  type Events,
  type Hooks
} from "/@/components/PageContainer";

const pageName = "order";
const basePath = "/sellOut/projectDetail";
// , handleResetClick, handleSearchClick
const { pageContentRef } = usePageSearch();
const { push } = useRouter();
const hooks: Hooks = {
  pageSearchHook: () => usePageSearch(undefined, undefined, searchConfig)
};
const {
  pageModalRef,
  // handleUpdateData,
  handleCreateData,
  handlePreviewData,
  handleConfrim,
  defaultInfo
} = usePageModal({ pageContentRef });
const events: Events = {
  content: {
    preview: row => handlePreviewData(row),
    create: row => handleCreateData(row)
  }
};
</script>

<template>
  <PageAuth :pageName="pageName">
    <PageContainer
      :hooks="hooks"
      :events="events"
      :search-config="searchConfig"
      :content-config="contentConfig"
    />
    <PageModal
      ref="pageModalRef"
      :modal-config="modalConfig"
      :default-info="defaultInfo"
      @confirm-btn-click="handleConfrim"
    />
  </PageAuth>
</template>
