<?php
namespace lucidpen;
if (!defined('ABSPATH'))
    exit;

use core\SingletonTrait;

class AssistantFactory
{
    use SingletonTrait;

    private array $assistantClasses = [];

    public function registerAssistantClass(string $className, bool $active = true)
    {
        $this->assistantClasses[$className] = $active;
    }

    public function setAssistantActive(string $className, bool $active)
    {
        if (isset($this->assistantClasses[$className])) {
            $this->assistantClasses[$className] = $active;
        }
    }

    public function isAssistantActive(string $className): bool
    {
        return $this->assistantClasses[$className] ?? false;
    }

    public function getAssistantClasses(): array
    {
        return $this->assistantClasses;
    }

    public function getActiveAssistantClasses(): array
    {
        return array_keys(array_filter($this->assistantClasses));
    }
}
