<?php

namespace Database\Seeders;

use App\Models\Role;
use Illuminate\Database\Seeder;

class RoleSeeder extends Seeder
{
    public function run(): void
    {
        $roles = [
            [
                'name' => 'Administrator',
                'slug' => 'admin',
                'description' => 'Full access to settings, media, users, roles, and content management.',
                'access_level' => 'admin',
                'permissions' => Role::defaultPermissionsForSlug('admin'),
                'is_system' => true,
            ],
            [
                'name' => 'Editor',
                'slug' => 'editor',
                'description' => 'Can manage pages, services, and inbound messages.',
                'access_level' => 'editor',
                'permissions' => Role::defaultPermissionsForSlug('editor'),
                'is_system' => true,
            ],
            [
                'name' => 'User',
                'slug' => 'user',
                'description' => 'Basic authenticated user with no admin panel access.',
                'access_level' => 'user',
                'permissions' => Role::defaultPermissionsForSlug('user'),
                'is_system' => true,
            ],
        ];

        foreach ($roles as $role) {
            Role::updateOrCreate(['slug' => $role['slug']], $role);
        }
    }
}
