<?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 = [


            // 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'],

            // Server License Management
            ['name' => 'add-server-license', 'description' => 'Add a server license', 'permission_group_name' => 'Server License Management'],
            ['name' => 'edit-server-license', 'description' => 'Edit a server license', 'permission_group_name' => 'Server License Management'],
            ['name' => 'edit-csv-mapping', 'description' => 'Edit CSV mapping', 'permission_group_name' => 'Server License Management'],
            ['name' => 'edit-print-form', 'description' => 'Edit print form', 'permission_group_name' => 'Server License Management'],
            ['name' => 'edit-user-interface', 'description' => 'Edit user interface', 'permission_group_name' => 'Server License Management'],
            ['name' => 'edit-global', 'description' => 'Edit global settings', 'permission_group_name' => 'Server License Management'],
            ['name' => 'edit-parameter', 'description' => 'Edit parameters', 'permission_group_name' => 'Server License Management'],
            ['name' => 'edit-onload', 'description' => 'Edit on-load settings', 'permission_group_name' => 'Server License Management'],
            ['name' => 'edit-validate', 'description' => 'Edit validation settings', 'permission_group_name' => 'Server License Management'],
            ['name' => 'edit-mapto', 'description' => 'Edit mapping', 'permission_group_name' => 'Server License Management'],
            ['name' => 'edit-mainvar', 'description' => 'Edit main variables', 'permission_group_name' => 'Server License Management'],
            ['name' => 'download-file-server-license', 'description' => 'Download server license file', 'permission_group_name' => 'Server License Management'],
            ['name' => 'list-history-patch', 'description' => 'List history patches', 'permission_group_name' => 'Server License Management'],
            ['name' => 'delete-server-license', 'description' => 'Delete a server license', 'permission_group_name' => 'Server License Management'],

            // Patch Management
            ['name' => 'add-patch', 'description' => 'Add a patch', 'permission_group_name' => 'Patch Management'],
            ['name' => 'edit-patch', 'description' => 'Edit a patch', 'permission_group_name' => 'Patch Management'],
            ['name' => 'delete-patch', 'description' => 'Delete a patch', 'permission_group_name' => 'Patch Management'],
            // Send Patch Management
            ['name' => 'send-patch', 'description' => 'Send Patch', 'permission_group_name' => 'Send Patch Management'],
            ['name' => 'resend-patch', 'description' => 'ReSend Patch', 'permission_group_name' => 'Send Patch Management'],
            ['name' => 'delete-send-patch', 'description' => 'Delete a Send Patch', 'permission_group_name' => 'Send Patch Management'],
            // Parameter Management
            ['name' => 'add-parameter', 'description' => 'Add a parameter', 'permission_group_name' => 'Parameter Management'],
            ['name' => 'edit-parameter', 'description' => 'Edit a parameter', 'permission_group_name' => 'Parameter Management'],
            ['name' => 'delete-parameter', 'description' => 'Delete a parameter', 'permission_group_name' => 'Parameter Management'],

            // Patch Exchange Rate Management
            ['name' => 'add-exchange-rate', 'description' => 'Add a Exchange Rate', 'permission_group_name' => 'Patch Enchangerate Management'],
            ['name' => 'upload-exchange-rate', 'description' => 'Upload Exchange Rate', 'permission_group_name' => 'Patch Enchangerate Management'],
            ['name' => 'edit-exchange-rate', 'description' => 'Edit a Exchange Rate', 'permission_group_name' => 'Patch Enchangerate Management'],
            ['name' => 'delete-exchange-rate', 'description' => 'Delete a Exchange Rate', 'permission_group_name' => 'Patch Enchangerate Management'],

            // Discharge Port Management
            ['name' => 'upload-discharge-port', 'description' => 'Uplaod Discharge Port', 'permission_group_name' => 'Patch Enchangerate Management'],

        ];


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