<?php

namespace Database\Seeders;
use App\Models\User;
use Illuminate\Database\Seeder;

class UserSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        User::create([
            'first_name' => 'Mauricio',
            'last_name' => 'García',
            'phone' => '3208200474',
            'email' => 'garmauco@gmail.com',
            'document_type' => '1',
            'document' => '5820557',
            'document_expedition' => 'Ibagué',
            'status' => 'ACTIVO',
            'password' => bcrypt('123123'),
            'professional_profile' => 'Developer web',
            'image' => '164253872261e726e256a57.png',
        ])->assignRole(['Soporte']);

        User::create([
            'first_name' => 'Ricardo',
            'last_name' => 'Díaz',
            'phone' => '3138230695',
            'email' => 'kerackdarcku@gmail.com',
            'document_type' => '1',
            'document' => '1110534536',
            'document_expedition' => 'Ibagué',
            'status' => 'ACTIVO',
            'password' => bcrypt('123456'),
            'professional_profile' => 'Diseñador web',
            'image' => '164256272161e784a18060c.jpg',
        ])->assignRole(['Administrador']);

        User::create([
            'first_name' => 'Administrador',
            'last_name' => 'Alira',
            'phone' => '3501231234',
            'email' => 'admin@alira.com.co',
            'document_type' => '1',
            'document' => '123321',
            'document_expedition' => 'Ibagué',
            'status' => 'ACTIVO',
            'password' => bcrypt('123123'),
            'professional_profile' => 'Administrador',
        ])->assignRole(['Super Admin']);

        User::create([
            'first_name' => 'Administrador',
            'last_name' => 'Empresa',
            'phone' => '3205478541',
            'email' => 'empresa@alira.com.co',
            'document_type' => '1',
            'document' => '5412356',
            'document_expedition' => 'Ibagué',
            'status' => 'ACTIVO',
            'password' => bcrypt('123123'),
            'professional_profile' => 'Administrador',
        ])->assignRole(['Administrador']);
        User::create([
            'first_name' => 'Empleado',
            'last_name' => '01',
            'phone' => '333 2222 111',
            'email' => 'empleado01@yopmail.com',
            'document_type' => '1',
            'document' => '123987546',
            'document_expedition' => 'Ibagué',
            'status' => 'ACTIVO',
            'password' => bcrypt('123456'),
        ])->assignRole(['Empleado']);
        $users =  User::factory(50)->create();

      foreach($users as $user){
          $r=rand(1,4);
            if($r==1){
                $user->assignRole(['Administrador']);
            }elseif($r==2){
                $user->assignRole(['Recursos humanos']);
            }elseif($r==3){
                $user->assignRole(['Asistente Administrativo']);
            }else{
                $user->assignRole(['Empleado']);
            }
        }
    }
}
