<template>
  <Information :notiNoEdit="notiNoEdit" v-model:statusEdit="statusEdit" />
  <Government
    :notiNoEdit="notiNoEdit"
    v-model:statusEdit="statusEdit"
    profileType="profileType"
    employeeClass="employeeClass"
  />
  <Address :notiNoEdit="notiNoEdit" v-model:statusEdit="statusEdit" />
  <Family :notiNoEdit="notiNoEdit" v-model:statusEdit="statusEdit" />
  <!-- <Certicate v-model:statusEdit="statusEdit" :profileType="profileType" /> -->
  <!-- <NotifyError
    :modalError="modalNoEdit"
    :modalErrorTittle="modalNoEditTittle"
    :modalErrorDetail="modalNoEditDetail"
    :close="closeModalError"
  /> -->
</template>
<script setup lang="ts">
import { ref, onMounted, watch } from "vue";
import Information from "@/modules/04_registry/components/Information/Information.vue";
import Government from "@/modules/04_registry/components/Information/Government.vue";
import Address from "@/modules/04_registry/components/Information/Address.vue";
import Family from "@/modules/04_registry/components/Information/Family.vue";
import Certicate from "@/modules/04_registry/components/Information/Certicate.vue";
// import NotifyError from "@/components/NotifyError.vue";

import { useCounterMixin } from "@/stores/mixin";

const props = defineProps({
  statusEdit: {
    type: Boolean,
    required: true,
  },
  profileType: {
    type: String,
    required: true,
  },
});
const emit = defineEmits(["update:statusEdit"]);

const mixin = useCounterMixin();
const { showLoader, hideLoader } = mixin;
const statusEdit = ref<boolean>(false);
const modalNoEdit = ref<boolean>(false);
const modalNoEditTittle = ref<string>("ไม่สามารถไม่สามารถแก้ไขข้อมูลได้?");
const modalNoEditDetail = ref<string>("มีข้อมูลที่ยังไม่ถูกบันทึกข้อมูล");

watch(statusEdit, (count: boolean, prevCount: boolean) => {
  emit("update:statusEdit", count);
});

watch(props, (count: any, prevCount: any) => {
  statusEdit.value = props.statusEdit;
});

onMounted(() => {
  hideLoader();
});

const notiNoEdit = () => {
  modalNoEdit.value = true;
};

const closeModalError = () => {
  modalNoEdit.value = false;
};
</script>
