<?php
namespace Misuzu\Config;

class ScopedConfigValueInfo implements IConfigValueInfo {
    private IConfigValueInfo $info;
    private int $prefixLength;

    public function __construct(IConfigValueInfo $info, int $prefixLength) {
        $this->info = $info;
        $this->prefixLength = $prefixLength;
    }

    public function getName(): string {
        return substr($this->info->getName(), $this->prefixLength);
    }

    public function getRealName(): string {
        return $this->info->getName();
    }

    public function getType(): string {
        return $this->info->getType();
    }

    public function isString(): bool {
        return $this->info->isString();
    }

    public function isInteger(): bool {
        return $this->info->isInteger();
    }

    public function isFloat(): bool {
        return $this->info->isFloat();
    }

    public function isBoolean(): bool {
        return $this->info->isBoolean();
    }

    public function isArray(): bool {
        return $this->info->isArray();
    }

    public function getValue(): mixed {
        return $this->info->getValue();
    }

    public function getString(): string {
        return $this->info->getString();
    }

    public function getInteger(): int {
        return $this->info->getInteger();
    }

    public function getFloat(): float {
        return $this->info->getFloat();
    }

    public function getBoolean(): bool {
        return $this->info->getBoolean();
    }

    public function getArray(): array {
        return $this->info->getArray();
    }

    public function __toString(): string {
        return (string)$this->info;
    }
}
