<?php
namespace Claromentis\Admin\Sysadmin\Controller;

$GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"] ?: array()) + array("_eb4d6202eab315cdfff169" . "3f1dcab500" => base64_decode("Y3VycmVudA=" . "="), "_1f24efd4735b7a11b39114" . "7435e7d35d" => base64_decode("cmVzdW" . "x0"), "_1689db965dcd5989e8faf5138" . "9aad5c4" => base64_decode("ZHJpdm" . "Vy"), "_6d77bf73" . "cec2f3b4e" . "c1e0d2e69" . "daf171" => base64_decode("dHJ" . "1ZQ" . "=="), "_fa8f8cf0c3fa" . "5d2608b31f5e1" . "0345a77" => base64_decode("cGFyYW1z" . "W10="), "_c8c3b03584" . "386ec653b03" . "1e02fbe9c9f" => base64_decode("ZXJyb" . "3JNZX" . "NzYWd" . "l"), "_4d707fab93beb" . "b00bbe69e81596" . "97c90" => base64_decode(""), "_9aa6d4c4fb39cfd9cb968f" . "1dc3f9f4d6" => base64_decode("dGVzd" . "E9jY3" . "VycmV" . "k"));
use Claromentis\Core\Http\JsonPrettyResponse;
use Claromentis\Core\Http\RequestData;
use Claromentis\Core\Http\ResponseFactory;
use Claromentis\Core\Mail\Api;
use Claromentis\Core\Mail\Exception\MailConnectionTestNotImplementedException;
use Claromentis\Core\Mail\Send\MailFactory;
class RestMailController
{
    public function TestConnection(Api $mailApi, RequestData $request_data, ResponseFactory $response_factory) : JsonPrettyResponse
    {
        $_1f24efd4735b7a11b391147435e7d35d = false;
        $_07f6883bc506cfe164fd8c5c0c721a1b = false;
        $error_message = $GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_4d707fab93bebb00bbe69e8159" . "697c90"];
        $_6fed8513ac9f5fcef048ae12d6c535a7 = false;
        if ($request_data->Get($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_eb4d6202eab315" . "cdfff1693f1dcab" . "500"]) === $GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_6d77bf73c" . "ec2f3b4ec1" . "e0d2e69daf" . "171"]) {
            $_6fed8513ac9f5fcef048ae12d6c535a7 = true;
        }
        $_69f63d634889ca8c0fd6310468af35b9 = $request_data->Get($GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_1689db9" . "65dcd598" . "9e8faf51" . "389aad5c" . "4"], $mailApi->getConfiguredDriverName());
        $_0c8a36a4f3c577e9de8a6b4ca61f3d34 = $request_data->Get($GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_fa8f8cf0c3fa" . "5d2608b31f5e1" . "0345a77"], []);
        try {
            if ($_6fed8513ac9f5fcef048ae12d6c535a7) {
                $mailApi->testCurrentConnection();
            } else {
                $mailApi->testConnection($_69f63d634889ca8c0fd6310468af35b9, $_0c8a36a4f3c577e9de8a6b4ca61f3d34);
            }
            $_1f24efd4735b7a11b391147435e7d35d = true;
            $_07f6883bc506cfe164fd8c5c0c721a1b = true;
        } catch (MailConnectionTestNotImplementedException $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            $error_message = $_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage();
        } catch (\Exception $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            $_07f6883bc506cfe164fd8c5c0c721a1b = true;
            $error_message = $_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage();
        }
        return $response_factory->GetJsonPrettyResponse([$GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_1f24efd" . "4735b7a1" . "1b391147" . "435e7d35" . "d"] => $_1f24efd4735b7a11b391147435e7d35d, $GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_9aa6d4c4" . "fb39cfd9c" . "b968f1dc3" . "f9f4d6"] => $_07f6883bc506cfe164fd8c5c0c721a1b, $GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_c8c3b03584386ec653b031e02" . "fbe9c9f"] => $error_message]);
    }
}