<?php

namespace Database\Seeders\Tenant;

use App\Facades\Settings;
use Illuminate\Database\Seeder;

class ApiUserRouteRestrictionSettingSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        collect($this->data())
            ->each(fn ($setting) => Settings::make($setting));
    }

    private function data(): array
    {
        return [
            [
                'tab' => 'Site',
                'section' => 'General',
                'group' => 'API access',
                'name' => 'Restrict API users to their allowed routes',
                'config_key' => 'api-users-restrict-routes',
                'superadmin' => true,
                'type' => 'boolean',
                'value' => true,
                'description' => 'When enabled, an authenticated API user may only call the routes that have been '
                    . 'explicitly granted to them. Disabling this lets any authenticated API user reach any API '
                    . 'route (a valid token and tenant access are still required).',
            ],
        ];
    }
}
