<?php
namespace Claromentis\Search;

$GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"] = (@$GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"] ?: array()) + array("excep" . "tion" => base64_decode("ZXhjZXB0aW9" . "u"), "_8b00b2ed1" . "fe72da2de8" . "37c9da056e" . "302" => base64_decode("c2VhcmNoLmFkb" . "WluLmNoZWNrX3" . "N0YXR1cy5lcnJ" . "vcg=="), "_635421990402eb6498db6391d31" . "938dd" => base64_decode("U2VhcmNoIFNlcnZpY2UgcGluZyBm" . "YWlsZWQ6IHJlY2VpdmVkIGFuIHVu" . "ZXhwZWN0ZWQgcmVzcG9uc2Uu"));
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["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_635421990402eb64" . "98db6391d31938dd"], [$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["exceptio" . "n"] => $e]);
            return new Exception(($this->lmsg)($GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_8b00b2ed1fe72da2de837c" . "9da056e302"]), $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;
        }
    }
}