<?php

namespace Database\Seeders;

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

class SuperAdminSeeder extends Seeder
{
    public function run(): void
    {
        $user = User::updateOrCreate(
            ['email' => 'admin@reservapro.test'],
            [
                'name'              => 'Súper Administrador',
                'password'          => Hash::make('password'),
                'is_active'         => true,
                'email_verified_at' => now(),
                'locale'            => 'es',
                'timezone'          => 'America/Bogota',
            ]
        );

        if (! $user->hasRole(UserRole::SuperAdmin->value)) {
            $user->assignRole(UserRole::SuperAdmin->value);
        }
    }
}
