<?php

namespace Database\Seeders;

use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Spatie\Permission\Models\Permission;
use Spatie\Permission\Models\Role;

class RolesTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $admin = Role::firstOrCreate(['name' => 'admin', 'guard_name' => 'web']);
        // $user = Role::firstOrCreate(['name' => 'user', 'guard_name' => 'web']);

        //  // Assign permissions ke role
        $admin->syncPermissions(Permission::all()); // Admin mendapatkan semua akses

        //   // Assign role `admin` ke user
        // $user->assignRole($admin);

        Role::firstOrCreate(['name' => 'Admin']);
        Role::firstOrCreate(['name' => 'Verifikator']);
        Role::firstOrCreate(['name' => 'Perusahaan']);
        Role::firstOrCreate(['name' => 'Admin Suku Dinas LH']);
        Role::firstOrCreate(['name' => 'Pedal']);
        Role::firstOrCreate(['name' => 'Admin Bidang']);
        Role::firstOrCreate(['name' => 'Admin PPU']);
        Role::firstOrCreate(['name' => 'Kajian Dampak Lingkungan']);
        Role::firstOrCreate(['name' => 'Instansi Umum']);
        Role::firstOrCreate(['name' => 'Gakkum']);
    }
}
