<?php

namespace Database\Seeders;

use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use App\Models\Permission;

class PermissionSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $permissions = [
            // File Management
            ['name' => 'upload-file', 'description' => 'Upload a file', 'permission_group_name' => 'File Management'],
            ['name' => 'download-file', 'description' => 'Download a file', 'permission_group_name' => 'File Management'],
        
            // Header Management
            ['name' => 'add-header', 'description' => 'Add a header', 'permission_group_name' => 'Header Management'],
            ['name' => 'edit-header', 'description' => 'Edit a header', 'permission_group_name' => 'Header Management'],
            ['name' => 'delete-header', 'description' => 'Delete a header', 'permission_group_name' => 'Header Management'],
            ['name' => 'send-customs', 'description' => 'Send customs', 'permission_group_name' => 'Header Management'],
            ['name' => 'export-to-spn', 'description' => 'Export to SPN', 'permission_group_name' => 'Header Management'],
            ['name' => 'cancel-header', 'description' => 'Cancel a header', 'permission_group_name' => 'Header Management'],
        
            // Detail Management
            ['name' => 'add-detail', 'description' => 'Add a detail', 'permission_group_name' => 'Detail Management'],
            ['name' => 'edit-detail', 'description' => 'Edit a detail', 'permission_group_name' => 'Detail Management'],
            ['name' => 'cancel-detail', 'description' => 'Cancel a detail', 'permission_group_name' => 'Detail Management'],
            ['name' => 'merge-vessel', 'description' => 'Merge vessel', 'permission_group_name' => 'Detail Management'],
        
            // Item Management
            ['name' => 'add-item', 'description' => 'Add an item', 'permission_group_name' => 'Item Management'],
            ['name' => 'edit-item', 'description' => 'Edit an item', 'permission_group_name' => 'Item Management'],
        
            // Flight Management
            ['name' => 'change-flight', 'description' => 'Change flight', 'permission_group_name' => 'Flight Management'],
        
            // User Management
            ['name' => 'add-user', 'description' => 'Add a user', 'permission_group_name' => 'User Management'],
            ['name' => 'edit-user', 'description' => 'Edit a user', 'permission_group_name' => 'User Management'],
            ['name' => 'delete-user', 'description' => 'Delete a user', 'permission_group_name' => 'User Management'],
        
            // Role Management
            ['name' => 'add-role', 'description' => 'Add a role', 'permission_group_name' => 'Role Management'],
            ['name' => 'edit-role', 'description' => 'Edit a role', 'permission_group_name' => 'Role Management'],
            ['name' => 'delete-role', 'description' => 'Delete a role', 'permission_group_name' => 'Role Management'],
        
            // Group Management
            ['name' => 'add-group', 'description' => 'Add a group', 'permission_group_name' => 'Group Management'],
            ['name' => 'edit-group', 'description' => 'Edit a group', 'permission_group_name' => 'Group Management'],
            ['name' => 'delete-group', 'description' => 'Delete a group', 'permission_group_name' => 'Group Management'],
        
            // Company Management
            ['name' => 'add-company', 'description' => 'Add a company', 'permission_group_name' => 'Company Management'],
            ['name' => 'edit-company', 'description' => 'Edit a company', 'permission_group_name' => 'Company Management'],
            ['name' => 'delete-company', 'description' => 'Delete a company', 'permission_group_name' => 'Company Management'],
        
            // Company Type Management
            ['name' => 'add-company-type', 'description' => 'Add a company type', 'permission_group_name' => 'Company Type Management'],
            ['name' => 'edit-company-type', 'description' => 'Edit a company type', 'permission_group_name' => 'Company Type Management'],
            ['name' => 'delete-company-type', 'description' => 'Delete a company type', 'permission_group_name' => 'Company Type Management']
        ];
        

        // // Insert permissions into the database
        foreach ($permissions as $permission) {
            Permission::create($permission);
        }
    }
}
