{{-- Render all homepage sections from theme config
     Usage in your layout: @include('florial::sections.renderer')
     
     Before using, initialize the ThemeService in your controller:
     themeService()->setTheme($currentTheme)->preload();
--}}
@php
    $ts = themeService()->boot();
    $allSections = $ts->sections();
@endphp

@foreach($allSections as $section)
    @if(!$section->is_active) @continue @endif

    @switch($section->type)
        @case('header')
            @include('florial::sections.header')
            @break

        @case('banner')
            @include('florial::sections.banner', ['sectionKey' => $section->key])
            @break

        @case('category_showcase')
            @include('florial::sections.category-showcase', ['sectionKey' => $section->key])
            @break

        @case('products')
            @include('florial::sections.products', ['sectionKey' => $section->key])
            @break

        @case('content_block')
            @include('florial::sections.content-block', ['sectionKey' => $section->key])
            @break

        @case('custom')
            {{-- Custom sections handled by their parent components --}}
            @break

        @case('footer')
            @include('florial::sections.footer')
            @break
    @endswitch
@endforeach
