<script setup lang="ts">
import { Head } from '@inertiajs/vue3';
import { ref } from 'vue';
import HomepageSection from './form/HomepageSection.vue';
import HrSection from './form/HrSection.vue';
import MarketplaceSection from './form/MarketplaceSection.vue';
import SocialMediaSection from './form/SocialMediaSection.vue';
import SystemSection from './form/SystemSection.vue';
import { SettingSection as SettingSectionConst } from '@/constants/setting-section';
import SettingLayout from '@/layouts/SettingLayout.vue';
import type {
    HomepageSettingsData,
    HrSettingsData,
    MarketplaceSettingsData,
    SettingSection,
    SocialMediaSettingsData,
    SystemSettingsData,
} from '@/types/setting';

defineProps<{
    system: SystemSettingsData;
    socialMedia: SocialMediaSettingsData;
    marketplace: MarketplaceSettingsData;
    hr: HrSettingsData;
    homepage: HomepageSettingsData;
}>();

const activeSection = ref<SettingSection>(SettingSectionConst.SYSTEM);
</script>

<template>

    <Head title="Pengaturan" />

    <SettingLayout v-model:section="activeSection">
        <SystemSection v-if="activeSection === SettingSectionConst.SYSTEM" :data="system" />
        <HomepageSection v-else-if="activeSection === SettingSectionConst.HOMEPAGE" :data="homepage" />
        <SocialMediaSection v-else-if="activeSection === SettingSectionConst.SOCIAL" :data="socialMedia" />
        <MarketplaceSection v-else-if="activeSection === SettingSectionConst.MARKETPLACE" :data="marketplace" />
        <HrSection v-else-if="activeSection === SettingSectionConst.HR" :data="hr" />
    </SettingLayout>
</template>
