<?php

namespace Database\Seeders;

use App\Models\User;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;

class UserSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $users = [
            [
                'name' => 'Admin User',
                'email' => 'admin@cms.local',
                'role' => 'admin',
            ],
            [
                'name' => 'Moderator User',
                'email' => 'moderator@cms.local',
                'role' => 'moderator',
            ],
            [
                'name' => 'On-site Team Member',
                'email' => 'onsite@cms.local',
                'role' => 'on_site_team',
            ],
            [
                'name' => 'Design Team Lead',
                'email' => 'design@cms.local',
                'role' => 'design_team',
            ],
            [
                'name' => 'Project Consultant',
                'email' => 'consultant@cms.local',
                'role' => 'project_consultant',
            ],
            [
                'name' => 'Client Team',
                'email' => 'client@cms.local',
                'role' => 'client_team',
            ],
        ];

        foreach ($users as $user) {
            User::firstOrCreate(
                ['email' => $user['email']],
                [
                    'name' => $user['name'],
                    'password' => Hash::make('password'),
                    'role' => $user['role'],
                    'email_verified_at' => now(),
                ]
            );
        }
    }
}
