<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Spatie\Permission\Models\Permission;

class VisibilityPermissionsSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $permissions = [
            [
                'name' => 'akses peringkat formasi',
                'guard_name' => 'api',
                'description' => 'Can view all data under their government level'
            ],
            [
                'name' => 'akses peringkat divisyen', 
                'guard_name' => 'api',
                'description' => 'Can view all data under their formation (DIV) level'
            ]
        ];

        foreach ($permissions as $permission) {
            Permission::firstOrCreate(
                ['name' => $permission['name'], 'guard_name' => $permission['guard_name']],
                $permission
            );
        }

        $this->command->info('Visibility permissions created successfully!');
    }
}
