<?php
namespace Claromentis\Search;

$GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"] ?: array()) + array("_8b00b2ed1fe72da2de837c9da" . "056e302" => base64_decode("c2VhcmNoLmFkbWluLmNoZWNrX3N0YXR1cy5lcn" . "Jvcg=="), "exceptio" . "n" => base64_decode("ZXhjZ" . "XB0aW" . "9u"), "_635421990402eb6498db6391d31" . "938dd" => base64_decode("U2VhcmNoIFNlcnZpY2UgcGluZyBmYWlsZWQ6IHJlY2VpdmVkIGFuIHVuZXhwZWN0ZWQgcmVzcG9uc2" . "Uu"));
use Claromentis\Core\Localization\Lmsg;
use Claromentis\Core\Services;
use Claromentis\Search\Client\ClientInterface;
use Claromentis\Search\Exception\SearchConfigException;
use Exception;
use Psr\Log\LoggerAwareTrait;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;








class DaemonControl
{
    use LoggerAwareTrait;
    protected ClientInterface $client;
    protected Lmsg $lmsg;
    
    
    
    
    public function __construct(ClientInterface $client, ?Lmsg $lmsg = null, ?LoggerInterface $logger = null)
    {
        $this->client = $client;
        $this->lmsg = $lmsg ?? Services::I()->{Lmsg::class};
        $this->setLogger($logger ?? new NullLogger());
    }
    
    
    
    
    
    
    public function GetStatus()
    {
        try {
            return $this->client->Ping();
        } catch (Exception $e) {
            $this->logger->error($GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_635421990402eb6498db6391d" . "31938dd"], [$GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["excep" . "tion"] => $e]);
            return new Exception(($this->lmsg)($GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_8b00b2ed1fe72da2de837c9da" . "056e302"]), $e->getCode(), $e);
        }
    }
    
    
    
    
    
    
    
    public function GetStats(array $_2e5fd271fda00a16d3201b16d65f393d = [])
    {
        try {
            return $this->client->GetStats($_2e5fd271fda00a16d3201b16d65f393d);
        } catch (Exception $e) {
            return $e;
        }
    }
    
    
    
    
    
    
    private function GetVersion()
    {
        try {
            return $this->client->GetVersion();
        } catch (Exception $e) {
            return $e;
        }
    }
}