<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;

class PermissionsSeeder extends Seeder
{
    public function run()
    {
        $json = file_get_contents(database_path('seeders/json/permissions_20251014.json'));
        $data = json_decode($json, true);

        foreach ($data['permissions'] as $permission) {
            DB::table('permissions')->insert(
                [
                    'id' => Str::uuid(),
                    'name' => $permission['name'], 
                    'guard_name' => $permission['guard_name'],
                    'created_at' => $permission['created_at'],
                    'updated_at' => $permission['updated_at'],
                    'route_name' => $permission['route_name'],
                ],
            );
        }
    }
}
