<?php

namespace Database\Seeders;

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


class PermissionSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $permissions = [

            // Dashboard
            'dashboard.view',

            // Device Management
            'devices.view',
            'devices.create',
            'devices.edit',
            'devices.delete',

            // Dispatch Management
            'dispatch.view',
            'dispatch.create',
            'dispatch.receive',
            'dispatch.edit',

            // Lease Management
            'leases.view',
            'leases.create',
            'leases.edit',
            'leases.audit',
            'leases.complete',

            // Inventory Management
            'inventory.view',
            'inventory.store',
            'inventory.sales',
            'inventory.border',
            'inventory.movements',

            // User Management
            'users.view',
            'users.create',
            'users.edit',
            'users.delete',

            // Roles & Permissions
            'roles.view',
            'roles.create',
            'roles.edit',
            'roles.delete',

            // Reports
            'reports.view',
            'reports.leases',
            'reports.audit',
            'reports.sales',
            'reports.devices',
            'reports.stock',

            // Settings
            'settings.view',
            'settings.edit',
            'billing.manage',
            'borderstations.manage',
            'tagpoints.manage',
        ];
        foreach ($permissions as $permission) {

            Permission::firstOrCreate([
                'name' => $permission
            ]);
        }
    }
}
