<?php
namespace Components\Data\Live;

use Components\Data\Contracts\ConfigStoreProvider;

class LiveConfigStoreProvider implements ConfigStoreProvider
{
    protected LiveLegacyConfigStoreProvider $legacy;
    protected LiveBeezUIConfigStoreProvider $beezui;

    public function __construct()
    {
        $this->legacy = new LiveLegacyConfigStoreProvider();
        $this->beezui = new LiveBeezUIConfigStoreProvider();
    }

    public function getAllConfigs(): array
    {
        return $this->legacy->getAllConfigs();
    }

    public function getModuleConfig(string $module): array
    {
        return $this->legacy->getModuleConfig($module);
    }

    public function setModuleConfig(string $module, array $values, bool $processOnlyGivenFields = false): void
    {
        $this->legacy->setModuleConfig($module, $values, $processOnlyGivenFields);
    }

    public function getAllStatuses(): array
    {
        return $this->legacy->getAllStatuses();
    }

    public function isModuleOn(string $module): bool
    {
        return $this->legacy->isModuleOn($module);
    }

    public function setModuleStatus(string $module, bool $on): void
    {
        $this->legacy->setModuleStatus($module, $on);
    }

    public function getUiOpenMap(): array
    {
        return $this->beezui->getUiOpenMap();
    }

    public function setUiOpenState(string $module, bool $open): void
    {
        $this->beezui->setUiOpenState($module, $open);
    }

    public function getColumnStateMap(): array
    {
        return $this->beezui->getColumnStateMap();
    }

    public function setColumnState(string $key, bool $visible): void
    {
        $this->beezui->setColumnState($key, $visible);
    }

    public function getDismissedNotifications(): array
    {
        return $this->beezui->getDismissedNotifications();
    }

    public function setNotificationDismissed(string $id, bool $dismissed): void
    {
        $this->beezui->setNotificationDismissed($id, $dismissed);
    }

    public function getListLayout(string $listId): string
    {
        return $this->beezui->getListLayout($listId);
    }

    public function setListLayout(string $listId, string $layout): void
    {
        $this->beezui->setListLayout($listId, $layout);
    }

    public function getListGrouped(string $listId, bool $default = true): bool
    {
        return $this->beezui->getListGrouped($listId, $default);
    }

    public function setListGrouped(string $listId, bool $grouped): void
    {
        $this->beezui->setListGrouped($listId, $grouped);
    }

    public function getListPerPage(string $listId, int $default = 25): int
    {
        return $this->beezui->getListPerPage($listId, $default);
    }

    public function setListPerPage(string $listId, int $perPage): void
    {
        $this->beezui->setListPerPage($listId, $perPage);
    }

    public function listKeys(string $module): array
    {
        return $this->legacy->listKeys($module);
    }

    public function isConfigured(string $module): bool
    {
        return $this->beezui->isConfigured($module);
    }

    public function setConfigured(string $module): void
    {
        $this->beezui->setConfigured($module);
    }

    public function clearConfigured(string $module): void
    {
        $this->beezui->clearConfigured($module);
    }

    public function getNewsletterUiState(string $pageMode = ''): array
    {
        return $this->beezui->getNewsletterUiState($pageMode);
    }

    public function setNewsletterUiState(array $patch, string $pageMode = ''): void
    {
        $this->beezui->setNewsletterUiState($patch, $pageMode);
    }

    public function getViewMode(string $context, string $default = 'journey'): string
    {
        return $this->beezui->getViewMode($context, $default);
    }

    public function setViewMode(string $context, string $mode): void
    {
        $this->beezui->setViewMode($context, $mode);
    }

    public function getCalendarFeedToken(): string
    {
        return $this->beezui->getCalendarFeedToken();
    }

    public function rotateCalendarFeedToken(): string
    {
        return $this->beezui->rotateCalendarFeedToken();
    }
}
