<?php

namespace Database\Seeders\Tenant;

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

class SantanderWidgetSettingSeeder extends Seeder
{
    public function run(): void
    {
        collect($this->data())
            ->each(fn ($setting) => Settings::make($setting));
    }

    private function data(): array
    {
        return [
            [
                'tab' => 'Automotive',
                'section' => 'Finance',
                'group' => 'Santander',
                'name' => 'Santander API Quoting Enabled',
                'config_key' => 'finance-santander-api-enabled',
                'min_tier' => 'standard',
                'type' => 'boolean',
                'value' => true,
                'description' => 'Run backend calls to Santander\'s QuotingTool API for listing-page monthlies and live quote refreshes on the built-in calculator. Turn off to rely on the SCUK widget only and skip all outbound API traffic.',
            ],
            [
                'tab' => 'Automotive',
                'section' => 'Finance',
                'group' => 'Santander',
                'name' => 'Santander Widget Enabled',
                'config_key' => 'finance-santander-widget-enabled',
                'min_tier' => 'standard',
                'type' => 'boolean',
                'value' => false,
                'description' => 'Render Santander\'s SCUK calculator widget on the vehicle detail page instead of the built-in calculator.',
            ],
            [
                'tab' => 'Automotive',
                'section' => 'Finance',
                'group' => 'Santander',
                'name' => 'Santander Widget API Key',
                'config_key' => 'finance-santander-widget-key',
                'min_tier' => 'standard',
                'type' => 'secret',
                'value' => '',
                'validation_rules' => [
                    'required_if:values.finance-santander-widget-enabled,true',
                ],
                'description' => 'API key issued by Santander for loading the SCUK calculator widget. Available in the SCUK portal under My Account > API.',
            ],
        ];
    }
}
