<?php

namespace Bastion\Services;

use Openguru\OpenCartFramework\Cache\CacheInterface;
use Openguru\OpenCartFramework\OpenCart\Decorators\OcRegistryDecorator;

class SettingsService
{
    private OcRegistryDecorator $registry;
    private CacheInterface $cache;

    public function __construct(OcRegistryDecorator $registry, CacheInterface $cache)
    {
        $this->registry = $registry;
        $this->cache = $cache;
    }

    public function update(array $data): void
    {
        $this->registry->model_setting_setting->editSetting('module_telecart', [
            'module_telecart_settings' => $data,
        ]);

        $this->cache->clear();
    }
}
