<?php

namespace Database\Seeders\Tenant;

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

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

    private function data(): array
    {
        return [
            [
                'tab' => 'Automotive',
                'section' => 'DMS vehicle sync',
                'group' => 'DealerKit',
                'name' => 'Stock sync enabled',
                'config_key' => 'stock-dealerkit-enabled',
                'type' => 'boolean',
                'value' => false,
                'description' => 'Import vehicle stock from DealerKit.',
            ],
            [
                'tab' => 'Automotive',
                'section' => 'DMS vehicle sync',
                'group' => 'DealerKit',
                'name' => 'API Secret',
                'config_key' => 'stock-dealerkit-api-secret',
                'type' => 'secret',
                'value' => '',
                'description' => 'Bearer token for DealerKit stock API requests.',
                'validation_rules' => [
                    'required_if:values.stock-dealerkit-enabled,true',
                ],
            ],
            [
                'tab' => 'Automotive',
                'section' => 'DMS vehicle sync',
                'group' => 'DealerKit',
                'name' => 'Use live API',
                'config_key' => 'stock-dealerkit-use-live-api',
                'type' => 'boolean',
                'value' => false,
                'description' => 'When off, stock requests go to the DealerKit test environment.',
            ],
            [
                'tab' => 'Automotive',
                'section' => 'DMS vehicle sync',
                'group' => 'DealerKit',
                'name' => 'Synchronize images',
                'config_key' => 'stock-dealerkit-sync-images',
                'type' => 'boolean',
                'value' => true,
            ],
            [
                'tab' => 'CRM',
                'section' => 'Integrations',
                'group' => 'DealerKit',
                'name' => 'CRM enabled',
                'config_key' => 'dealerkit-crm-enabled',
                'type' => 'boolean',
                'value' => false,
                'description' => 'Send enquiry leads to DealerKit.',
            ],
            [
                'tab' => 'CRM',
                'section' => 'Integrations',
                'group' => 'DealerKit',
                'name' => 'API Secret',
                'config_key' => 'dealerkit-crm-api-secret',
                'type' => 'secret',
                'value' => '',
                'description' => 'Bearer token for DealerKit CRM lead requests.',
                'validation_rules' => [
                    'required_if:values.dealerkit-crm-enabled,true',
                ],
            ],
            [
                'tab' => 'CRM',
                'section' => 'Integrations',
                'group' => 'DealerKit',
                'name' => 'Use live API',
                'config_key' => 'dealerkit-crm-use-live-api',
                'type' => 'boolean',
                'value' => false,
                'description' => 'When off, lead requests go to the DealerKit test environment.',
            ],
        ];
    }
}
