<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use App\Models\Announcement;
use App\Models\User;
use Carbon\Carbon;

class AnnouncementSeeder extends Seeder
{
    public function run(): void
    {
        $admin = User::where('role', 'super_admin')->first();

        Announcement::updateOrCreate(
            ['title' => 'Welcome to WorkFlow System'],
            [
                'created_by' => $admin->id,
                'body' => 'We have successfully launched our new Attendance & Task Management system.',
                'is_active' => true,
                'pinned' => true,
                'expires_at' => Carbon::now()->addMonths(1),
            ]
        );

        Announcement::updateOrCreate(
            ['title' => 'Quarterly Meeting'],
            [
                'created_by' => $admin->id,
                'body' => 'All hands meeting scheduled for next Monday at 10:00 AM in the conference hall.',
                'is_active' => true,
                'pinned' => false,
                'expires_at' => Carbon::now()->addDays(7),
            ]
        );
    }
}
