<?php

namespace AutoAdmin\Bundle\Log\Configuration;

use Monolog\Level;
use Monolog\Logger;

class ConfigManager
{
    private array $config;

    public function __construct(array $config)
    {
        $this->config = $config;
    }

    public function logEnabled(): bool
    {
        return $this->config['enabled'] && !empty($this->config['token']);
    }

    public function getToken(): ?string
    {
        return $this->config['token'] ?? null;
    }

    public function getLevel(): string
    {
        return $this->config['level'];
    }

    public function getMonologLevel(): Level
    {
        return Logger::toMonologLevel($this->getLevel());
    }
}
