<?php

namespace Database\Seeders;

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

class CategorySeeder extends Seeder
{
    public function run(): void
    {
        $fashion = Category::firstOrCreate(
            ['slug' => 'fashion'],
            ['name' => 'Fashion']
        );

        Category::firstOrCreate(
            ['slug' => 'pria'],
            [
                'name' => 'Pria',
                'parent_id' => $fashion->id
            ]
        );

        Category::firstOrCreate(
            ['slug' => 'wanita'],
            [
                'name' => 'Wanita',
                'parent_id' => $fashion->id
            ]
        );

        $electronics = Category::firstOrCreate(
            ['slug' => 'electronics'],
            ['name' => 'Electronics']
        );

        Category::firstOrCreate(
            ['slug' => 'smartphones'],
            [
                'name' => 'Smartphones',
                'parent_id' => $electronics->id
            ]
        );

        Category::firstOrCreate(
            ['slug' => 'home-living'],
            ['name' => 'Home & Living']
        );
    }
}
