<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 Modal from "./Modal.vue"

const PageName = "purchaseSetting";
const instance = ref<any>(null);

const disabled = ref(false)
const visible = ref(false)
const data = ref<any>({})

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

const events: PageEvents = {
  content: {
    create: () => {
      disabled.value = false
      visible.value = true
    },
  }
};
</script>

<template>
  <PageAuth :pageName="PageName">
    <PageContainer 
      :hooks="hooks" 
      :events="events" 
      :contentConfig="contentConfig" 
      :search-config="searchConfig"
      :get-content-ref="ref => (instance = ref)"
    />

    <Modal v-model:visible="visible" @refresh="instance?.onSearch" />
  </PageAuth>
</template>
