<?php

namespace Database\Seeders\Tenant;

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

class TawkToSettingSeeder 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' => 'Live Chat',
                'group' => 'Tawk.to',
                'name' => 'Enabled',
                'config_key' => 'chat-tawk-to-enabled',
                'type' => 'boolean',
                'value' => false,
                'order' => 0,
            ],
            [
                'tab' => 'CRM',
                'section' => 'Live Chat',
                'group' => 'Tawk.to',
                'name' => 'Account Key',
                'config_key' => 'chat-tawk-to-account_key',
                'type' => 'string',
                'value' => '',
                'order' => 1,
                'validation_rules' => [
                    "required_if:values.chat-tawk-to-enabled,true"
                ]
            ],
            [
                'tab' => 'CRM',
                'section' => 'Live Chat',
                'group' => 'Tawk.to',
                'name' => 'Widget ID',
                'config_key' => 'chat-tawk-to-widget_id',
                'type' => 'string',
                'value' => '',
                'order' => 2,
                'validation_rules' => [
                    "required_if:values.chat-tawk-to-enabled,true"
                ]
            ],
        ];
    }
}
