<script setup lang="ts">
import { Settings2, Share2, ShoppingBag } from '@lucide/vue';
import AdminLayout from '@/layouts/AdminLayout.vue';
import { cn } from '@/lib/utils';
import type { SettingSection } from '@/types/setting';

const activeSection = defineModel<SettingSection>('section', { required: true });

const navItems: Array<{
    key: SettingSection;
    label: string;
    icon: typeof Settings2;
}> = [
        { key: 'system', label: 'Sistem', icon: Settings2 },
        { key: 'social', label: 'Media Sosial', icon: Share2 },
        { key: 'marketplace', label: 'Marketplace', icon: ShoppingBag },
    ];
</script>

<template>
    <AdminLayout>
        <div class="space-y-6">
            <div class="space-y-1">
                <h2 class="text-2xl font-bold tracking-tight">
                    Pengaturan
                </h2>
            </div>

            <div class="flex flex-col gap-6 lg:flex-row">
                <nav class="flex shrink-0 flex-row gap-1 overflow-x-auto lg:w-56 lg:flex-col lg:overflow-visible">
                    <button v-for="item in navItems" :key="item.key" type="button" :class="cn(
                        'inline-flex items-center gap-2 rounded-md px-3 py-2 text-sm font-medium whitespace-nowrap transition-colors',
                        activeSection === item.key
                            ? 'bg-accent text-accent-foreground'
                            : 'text-muted-foreground hover:bg-accent/50 hover:text-accent-foreground',
                    )" @click="activeSection = item.key">
                        <component :is="item.icon" class="size-4 shrink-0" />
                        {{ item.label }}
                    </button>
                </nav>

                <div class="min-w-0 flex-1">
                    <slot />
                </div>
            </div>
        </div>
    </AdminLayout>
</template>
