<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use App\Models\Announcement;
use App\Services\DummyDataService;

class AnnouncementSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $announcements = DummyDataService::getPengumuman();

        foreach ($announcements as $data) {
            Announcement::updateOrCreate(
                ['id' => $data['id']],
                [
                    'type' => $data['type'],
                    'icon' => $data['icon'],
                    'title' => $data['title'],
                    'content' => $data['content'],
                ]
            );
        }
    }
}
