<?php

namespace Database\Seeders;

use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use App\Models\User;
use App\Models\Empresa;
use Illuminate\Support\Facades\Hash;

class UserSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run()
    {
        $empresa = Empresa::first(); // asocia empleados y admins a esta empresa
    
        User::create([
            'name' => 'Super Admin',
            'email' => 'superadmin@boton.cl',
            'password' => Hash::make('12345678'),
            'role' => 'superadmin',
            'telefono' => '+56911111111',
        ]);
    
        User::create([
            'name' => 'Admin Empresa',
            'email' => 'empresa@boton.cl',
            'password' => Hash::make('12345678'),
            'role' => 'empresa_admin',
            'empresa_id' => $empresa->id,
            'telefono' => '+56922222222',
        ]);
    
        User::create([
            'name' => 'Empleado 1',
            'email' => 'empleado@boton.cl',
            'password' => Hash::make('12345678'),
            'role' => 'empleado',
            'empresa_id' => $empresa->id,
            'telefono' => '+56933333333',
        ]);
    
        User::create([
            'name' => 'Usuario Final',
            'email' => 'usuario@boton.cl',
            'password' => Hash::make('12345678'),
            'role' => 'usuario_final',
            'telefono' => '+56944444444',
        ]);
    
        User::create([
            'name' => 'Operador Central',
            'email' => 'operador@boton.cl',
            'password' => Hash::make('12345678'),
            'role' => 'operador',
            'telefono' => '+56955555555',
        ]);
    
        User::create([
            'name' => 'Guardia',
            'email' => 'seguridad@boton.cl',
            'password' => Hash::make('12345678'),
            'role' => 'seguridad',
            'empresa_id' => $empresa->id,
            'telefono' => '+56966666666',
        ]);
    }
}
