<?php

declare(strict_types=1);

namespace CliqThemes\UI\Support;

/**
 * Simple feature flag container so integrators can opt-in to experimental functionality.
 */
final class FeatureFlags
{
    private bool $wordpressBridge;

    public function __construct(bool $wordpressBridge = false)
    {
        $this->wordpressBridge = $wordpressBridge;
    }

    /**
     * Hydrates a flag set from a configuration array.
     *
     * @param array<string,mixed> $flags
     */
    public static function fromArray(array $flags): self
    {
        return new self((bool)($flags['wordpress_bridge'] ?? false));
    }

    /**
     * Indicates whether the WordPress integration bridge should register hooks.
     */
    public function wordpressBridgeEnabled(): bool
    {
        return $this->wordpressBridge;
    }
}
