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

$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"] = (@$GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"] ?: array()) + array("_c8c3b03584386ec6" . "53b031e02fbe9c9f" => base64_decode("ZXJyb3JNZX" . "NzYWdl"), "_4d707fab93bebb00bbe" . "69e8159697c90" => base64_decode(""), "_1f24efd4735b" . "7a11b39114743" . "5e7d35d" => base64_decode("cmVzdWx" . "0"), "_fa8f8cf0c3fa5d2608b31f5" . "e10345a77" => base64_decode("cGFyYW1zW10" . "="), "_eb4d6202eab315cdfff1" . "693f1dcab500" => base64_decode("Y3VycmVudA=" . "="), "_1689db965dcd59" . "89e8faf51389aad" . "5c4" => base64_decode("ZHJpd" . "mVy"), "_6d77bf73cec2f3b4ec1e0" . "d2e69daf171" => base64_decode("dH" . "J1" . "ZQ" . "=="), "_9aa6d4c4fb" . "39cfd9cb968" . "f1dc3f9f4d6" => base64_decode("dGVzdE9jY" . "3VycmVk"));
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["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_4d707fa" . "b93bebb0" . "0bbe69e8" . "159697c9" . "0"];
        $_6fed8513ac9f5fcef048ae12d6c535a7 = false;
        if ($request_data->Get($GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_eb4d6202e" . "ab315cdfff" . "1693f1dcab" . "500"]) === $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_6d77bf73cec2f3b4ec1e0d2e" . "69daf171"]) {
            $_6fed8513ac9f5fcef048ae12d6c535a7 = true;
        }
        $_69f63d634889ca8c0fd6310468af35b9 = $request_data->Get($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_1689db965dcd5989e8faf" . "51389aad5c4"], $mailApi->getConfiguredDriverName());
        $_0c8a36a4f3c577e9de8a6b4ca61f3d34 = $request_data->Get($GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_fa8f8cf0c3fa5d2608b3" . "1f5e10345a77"], []);
        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["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_1f24efd4735b7a11b39114" . "7435e7d35d"] => $_1f24efd4735b7a11b391147435e7d35d, $GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_9aa6d4c4fb3" . "9cfd9cb968f1" . "dc3f9f4d6"] => $_07f6883bc506cfe164fd8c5c0c721a1b, $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_c8c3b03584386ec653b031e02f" . "be9c9f"] => $error_message]);
    }
}