<?php
namespace Misuzu;

use Misuzu\Config\IConfig;

final class Config {
    private static IConfig $config;

    public static function init(IConfig $config): void {
        self::$config = $config;
    }

    public static function keys(): array {
        return self::$config->getNames();
    }

    public static function get(string $key, string $type = IConfig::T_ANY, $default = null): mixed {
        return self::$config->getValue($key, $type, $default);
    }

    public static function has(string $key): bool {
        return self::$config->hasValue($key);
    }

    public static function set(string $key, $value, bool $soft = false): void {
        self::$config->setValue($key, $value, !$soft);
    }

    public static function remove(string $key, bool $soft = false): void {
        self::$config->removeValue($key, !$soft);
    }
}
