<?php

namespace Database\Seeders;

use App\Models\User;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    use WithoutModelEvents;

    /**
     * Seed the application's database.
     */
    public function run(): void
    {
        // Create Admin User
        if (!\Illuminate\Support\Facades\DB::table('users')->where('email', 'admin@example.com')->exists()) {
            \Illuminate\Support\Facades\DB::table('users')->insert([
                'name' => 'Admin User',
                'email' => 'admin@example.com',
                'password' => \Illuminate\Support\Facades\Hash::make('password'),
                'role' => 'admin',
                'created_at' => now(),
                'updated_at' => now(),
            ]);
        }

        // Call Seeders
        $this->call([
            WorkerCategorySeeder::class,
            SkillSeeder::class,
            WorkerSeeder::class,
            EmployerProfileSeeder::class,
            JobPostSeeder::class,
            ConversationSeeder::class,
            SupportTicketSeeder::class,
        ]);
    }
}
