<?php

namespace Database\Seeders;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
use Illuminate\Database\Seeder;

class UserSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        \App\Models\User::factory()->create([
            'first_name' => 'Super',
            'last_name' => 'Admin',
            'name' => 'SuperAdmin',
            'username' => 'admin',
            'email' => 'admin@example.com',
            'password' => Hash::make('password'),
            'default_dealership_id' => 1,
            'email_verified_at' => now(),
            'remember_token' => Str::random(10),
            'created_at' => now(),
            'updated_at' => now(),
        ]);
        \App\Models\User::factory()->create([
            'first_name' => 'Demo',
            'last_name' => 'Admin',
            'name' => 'Demo Admin',
            'username' => 'demo',
            'email' => 'demo@example.com',
            'default_dealership_id' => 1,
            'password' => Hash::make('password'),
            'email_verified_at' => now(),
            'remember_token' => Str::random(10),
            'created_at' => now(),
            'updated_at' => now(),
        ]);
        \App\Models\RoleGroup::create([
            'id' => 1,
            'name' => 'Super Admin',
            'created_at' => now(),
            'updated_at' => now(),
        ]);
        \App\Models\RoleGroup::create([
            'id' => 2,
            'name' => 'Admin',
            'created_at' => now(),
            'updated_at' => now(),
        ]);
        \App\Models\RoleGroup::create([
            'id' => 3,
            'name' => 'Employee',
            'created_at' => now(),
            'updated_at' => now(),
        ]);
        \App\Models\RoleGroup::create([
            'id' => 4,
            'name' => 'HR Staff',
            'created_at' => now(),
            'updated_at' => now(),
        ]);
        \App\Models\RoleGroup::create([
            'id' => 5,
            'name' => 'HR Admin',
            'created_at' => now(),
            'updated_at' => now(),
        ]);
        \App\Models\Role::create([
            'id' => 1,
            'name' => 'Super Admin',
            'group_id' => 1,
            'created_at' => now(),
            'updated_at' => now(),
        ]);
        \App\Models\Role::create([
            'id' => 2,
            'name' => 'Admin',
            'group_id' => 2,
            'created_at' => now(),
            'updated_at' => now(),
        ]);
        \App\Models\Role::create([
            'id' => 5,
            'name' => 'Buyer',
            'group_id' => 5,
            'created_at' => now(),
            'updated_at' => now(),
        ]);
        \App\Models\Role::create([
            'id' => 6,
            'name' => 'Procurement Supervisor',
            'group_id' => 6,
            'created_at' => now(),
            'updated_at' => now(),
        ]);
        \App\Models\Role::create([
            'id' => 7,
            'name' => 'Procurement Manager',
            'group_id' => 7,
            'created_at' => now(),
            'updated_at' => now(),
        ]);
        \App\Models\Role::create([
            'id' => 8,
            'name' => 'Execom',
            'group_id' => 8,
            'created_at' => now(),
            'updated_at' => now(),
        ]);
        \App\Models\Role::create([
            'id' => 9,
            'name' => 'Supplier',
            'group_id' => 9,
            'created_at' => now(),
            'updated_at' => now(),
        ]);
        \App\Models\Role::create([
            'id' => 10,
            'name' => 'Treasury Officer',
            'group_id' => 10,
            'created_at' => now(),
            'updated_at' => now(),
        ]);
        \App\Models\Role::create([
            'id' => 11,
            'name' => 'Accounting Officer',
            'group_id' => 11,
            'created_at' => now(),
            'updated_at' => now(),
        ]);
        \App\Models\UserRole::create([
            'role_id' => 1,
            'user_id' => 1,
            'created_at' => now(),
            'updated_at' => now(),
        ]);
        \App\Models\UserRole::create([
            'role_id' => 2,
            'user_id' => 2,
            'created_at' => now(),
            'updated_at' => now(),
        ]);
    }
}
