<?php

namespace Database\Seeders;

use App\Models\Badge;
use App\Models\Option;
use App\Services\Quiz\BadgeService;
use Illuminate\Database\Seeder;

class BadgeSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $badges = BadgeService::badges();

        foreach ($badges as $badge) {
            unset($badge['class']);
            Badge::updateOrCreate(
                ['slug' => $badge['slug']],
                $badge
            );
        }

        Option::updateOption('badge_criteria', BadgeService::getCriteriaTypes());
    }
}
