<?php

namespace Database\Seeders;

use App\Models\HomepageSection;
use Illuminate\Database\Seeder;

class HomepageSectionsSeeder extends Seeder
{
    public function run(): void
    {
        $sections = [
            [
                'slug'       => 'hero',
                'label'      => 'Hero Banner',
                'icon'       => 'hero',
                'is_visible' => true,
                'sort_order' => 1,
                'config'     => [],
            ],
            [
                'slug'       => 'products',
                'label'      => 'Latest Products',
                'icon'       => 'inventory_2',
                'is_visible' => true,
                'sort_order' => 2,
                'config'     => ['count' => 6],
            ],
            [
                'slug'       => 'blog',
                'label'      => 'Latest Blog Posts',
                'icon'       => 'article',
                'is_visible' => true,
                'sort_order' => 3,
                'config'     => ['count' => 3],
            ],
        ];

        foreach ($sections as $data) {
            HomepageSection::updateOrCreate(['slug' => $data['slug']], $data);
        }
    }
}
