<script setup lang="ts">
import { useRouter } from 'vue-router'
import { withBase } from '~/models/_base'
import type { HeaderPrep } from '~/components/pub/my-ui/data/types'
import type { Patient } from '~/models/patient'
import type { Person } from '~/models/person'
import { getDetail } from '~/services/prb.service'

// Components
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
import type { Prb } from '~/models/prb'

// #region Props & Emits
const props = defineProps<{
}>()

// #endregion

// #region State & Computed

const route = useRoute()
const router = useRouter()
const encounterId = typeof route.params.id == 'string' ? parseInt(route.params.id) : 0
const PrbId = typeof route.params.surgery_report_id == 'string' ? parseInt(route.params.surgery_report_id) : 0
const Prb = ref<Prb | null>(null)

const headerPrep: HeaderPrep = {
  title: 'Detail Program Rujuk Balik',
  icon: 'i-lucide-newspaper',
}

// #endregion

// #region Lifecycle Hooks
// onMounted(async () => {
//   const result = await getDetail(controlLetterId, {
//     includes: "unit,specialist,subspecialist,doctor-employee-person",
//   })
//   if (result.success) {
//     controlLetter.value = result.body?.data
//   }
// })
// #endregion

// #region Functions
function goBack() {
  router.go(-1)
}

// #endregion region

// #region Utilities & event handlers
function handleAction() {
  goBack()
}
// #endregion

// #region Watchers
// #endregion
</script>

<template>
  <Header :prep="headerPrep" :ref-search-nav="headerPrep.refSearchNav" />
  <AppPrbDetail :instance="Prb" @click="handleAction" />
</template>
