<?php

namespace Database\Seeders\Tenant;

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

class CallGearSettingSeeder 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' => 'CRM',
                'section' => 'Integrations',
                'group' => 'CallGear',
                'name' => 'Enabled',
                'config_key' => 'crm-callgear-enabled',
                'type' => 'boolean',
                'value' => false,
                'order' => 0,
                'description' => '<a href="https://www.callgear.com/" target="_blank">CallGear</a> integration'
            ],
            [
                'tab' => 'CRM',
                'section' => 'Integrations',
                'group' => 'CallGear',
                'name' => 'Key',
                'config_key' => 'crm-callgear-key',
                'type' => 'secret',
                'value' => '',
                'order' => 1,
                'validation_rules' => [
                    "required_if:values.crm-callgear-enabled,true"
                ]
            ],
        ];
    }
}
