<?php

namespace Database\Seeders;

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

class UserSeeder extends Seeder
{
    public function run(): void
    {
        $users = [
            [
                'name'              => 'Admin Sistema',
                'email'             => 'admin@nuna.com',
                'password'          => Hash::make('admin1234'),
                'role'              => UserRole::AdminSistema,
                'email_verified_at' => now(),
            ],
            [
                'name'              => 'Contador Admin',
                'email'             => 'contador@nuna.com',
                'password'          => Hash::make('contador1234'),
                'role'              => UserRole::ContadorAdmin,
                'email_verified_at' => now(),
            ],
            [
                'name'              => 'Gestor Cuenta',
                'email'             => 'gestor@nuna.com',
                'password'          => Hash::make('gestor1234'),
                'role'              => UserRole::GestorCuenta,
                'email_verified_at' => now(),
            ],
            [
                'name'              => 'Tania Romero',
                'email'             => 'tania@nuna.tech',
                'password'          => Hash::make('tania1234'),
                'role'              => UserRole::GestorCuenta,
                'email_verified_at' => now(),
            ],
            [
                'name'              => 'Israel Soto',
                'email'             => 'israel@nuna.tech',
                'password'          => Hash::make('israel1234'),
                'role'              => UserRole::Vendedor,
                'email_verified_at' => now(),
            ],
        ];

        foreach ($users as $userData) {
            User::updateOrCreate(['email' => $userData['email']], $userData);
        }
    }
}
