<script setup lang="ts">
import { crudQueryParamsMode } from '~/lib/system-constants';
import List from './list.vue'
import Entry from './entry.vue'

const props = defineProps<{
  encounter_id: number
}>()

const { crudQueryParams, goToDetail, goToEntry } = useQueryCRUD()
</script>

<template>
  <List v-if="crudQueryParams.mode === crudQueryParamsMode.list"
    :encounter_id="encounter_id"
    :redirectToForm="goToEntry"
    :redirectToDetail="goToDetail"/>
  <Entry v-else-if="crudQueryParams.mode === crudQueryParamsMode.entry"
    :encounter_id="encounter_id"
    :record_id="crudQueryParams.recordId" />
    
  <List v-else :encounter_id="encounter_id" :redirectToForm="goToEntry" :redirectToDetail="goToDetail" />
</template>
