<?php
namespace Claromentis\Core\Ai;

$GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"] ?: array()) + array();
use Claromentis\Core\Ai\Exceptions\AiException;
use Psr\Container\ContainerInterface;








class AiFactory
{
    private ContainerInterface $container;
    private string $prefix;
    
    
    
    
    
    public function __construct(ContainerInterface $_5e4594441b0e531bfd6f0011e0327611, string $prefix)
    {
        $this->container = $_5e4594441b0e531bfd6f0011e0327611;
        $this->prefix = $prefix;
    }
    
    
    
    
    
    
    
    public function create(string $name) : AiAdapterInterface
    {
        $_557ada9d10497c96b6f4d0123ffaece0 = $this->prefix . $name;
        if (!isset($this->container[$_557ada9d10497c96b6f4d0123ffaece0])) {
            throw AiException::unknownAdapterType($_557ada9d10497c96b6f4d0123ffaece0);
        }
        $ai = $this->container->get($this->prefix . $name);
        if (!$ai || !$ai instanceof AiAdapterInterface) {
            throw AiException::unknownAdapterType($_557ada9d10497c96b6f4d0123ffaece0);
        }
        return $ai;
    }
}