<?php
namespace Claromentis\Quiz\Controller\Rest\V2;

$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"] = (@$GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"] ?: array()) + array("i" . "d" => base64_decode("a" . "W" . "Q" . "="), "_e6c8501" . "26cff293" . "d170e2d7" . "ab4e2aad" . "4" => base64_decode("YXR0Z" . "W1wdH" . "M="), "qu" . "es" . "ti" . "on" . "s" => base64_decode("cXVl" . "c3Rp" . "b25z"), "po" . "ll" . "_i" . "d" => base64_decode("cG9sbF9" . "pZA=="), "_4d707fab9" . "3bebb00bbe" . "69e8159697" . "c90" => base64_decode(""), "_b8c80e08" . "7c6f3f3d1" . "f3c9f67bc" . "ec160d" => base64_decode("Y2FuX3ZpZXdfc3RhdGlzdGlj" . "cw=="), "_d054d8a" . "c9359ad6" . "2ec6ae6a" . "8e108b57" . "8" => base64_decode("cXVpei5wb2xsLmVycm" . "9yLm5vX3F1ZXN0aW9u"), "_4a9a895314c5571ef8" . "262129ca6a8044" => base64_decode("Y2FuX3ByZX" . "ZpZXc="), "_7adc269a13af5c45b5a1caf4e" . "c75a795" => base64_decode("YXR0ZW1wdA" . "=="), "_4196faadc" . "878e30e23a" . "63bd8ff6d8" . "4a9" => base64_decode("cXVpei5yZXBvc2l0b3J5LnF1ZXN0aW" . "9u"), "_221da17e3055fae8d3ff516b832" . "a5f3b" => base64_decode("cG" . "Fn" . "ZQ" . "=="), "_4d23920b3dd84f98af3028a8a3aa2" . "5f9" => base64_decode("cXVpei5wb" . "2xsLmVycm" . "9yLm5vdF9" . "mb3VuZA=="), "_33f09d76394" . "b074b779265f" . "857d5ec8a" => base64_decode("Y291bnRfc2FmZQ" . "=="), "_a2c1535293d134e078c87c81de95" . "f1d1" => base64_decode("cGhy" . "YXNl"), "_f1af70b59fcba61939cba0f4936" . "7d285" => base64_decode("cG9s" . "bHM="), "qu" . "es" . "ti" . "on" => base64_decode("cXVl" . "c3Rp" . "b24="), "_79bd870609" . "93ff622ef21" . "2c1e8b6a79a" => base64_decode("Rm9yYmlkZGV" . "u"), "_c894747" . "360c6ec5" . "bd816953" . "0eaf9c47" . "3" => base64_decode("QmFkIFJlcXV" . "lc3Q="), "_64666bcf1e5aaa07774f3d74" . "39ff264d" => base64_decode("Y29" . "tcG" . "xld" . "GVk"), "_e2a6cc9ef64b3dd21757612b64" . "b07d09" => base64_decode("Y2FuX3ZpZXdfc3Rh" . "dHVz"), "_7f5aa4e9" . "6d4b415a8" . "6ed72ebff" . "677cbe" => base64_decode("cXV" . "lcn" . "k="), "_54b269a12af880b045f6712e6f865" . "462" => base64_decode("c3Rh" . "dHVz"), "_9137964f9a3" . "38e89f979757" . "c23fc020d" => base64_decode("Y3JlYXRlZF9kY" . "XRlIERFU0M="), "_cceda81802" . "0fabce32923" . "00389f8560a" => base64_decode("YXR0Z" . "W1wdH" . "NfY29" . "1bnQ="), "_2622beacb6c29bde687d2f80c92ba" . "ef1" => base64_decode("Y2FuX2F0d" . "GVtcHQ="), "_f4eafa5f493306ffdb51" . "a688b21dd507" => base64_decode("dG90YW" . "w="), "_2e8e0758094679b3cb5171c8c3" . "d880f6" => base64_decode("WW91IGNhbiBhZGQgb25seSBvbmUgcXVlc3Rpb24gdG8gdGhlIHBv" . "bGw="), "_0c7db5a" . "15ed94cc" . "1be4b039" . "915fb081" . "4" => base64_decode("Y2FuX3JldGFr" . "ZQ=="), "_f11369824f533e8206f9ccc0c9a" . "ab3a0" => base64_decode("bG" . "lt" . "aX" . "Q="), "_b3ee1ca1d7e4bff63ae7779684833" . "25d" => base64_decode("cG" . "9s" . "bA" . "=="), "_5630a508eaf62fdbab" . "410362fa17735c" => base64_decode("cGVybW" . "lzc2lv" . "bnM="), "_f2d41627f0927" . "0f0dbd21d27e02" . "868d7" => base64_decode("cmVzZX" . "Q="), "_08810531932e1a6e70a95d358d14c87" . "9" => base64_decode("Y2FuX21" . "hbmFnZQ" . "=="));
use Claromentis\Core\Application;
use Claromentis\Core\Http\JsonPrettyResponse;
use Claromentis\Core\Http\RequestData;
use Claromentis\Core\Http\RequestDataException;
use Claromentis\Core\Localization\Lmsg;
use Claromentis\Core\Repository\Exception\NotFoundException;
use Claromentis\Core\REST\RestFormatter;
use Claromentis\People\Exception\PermissionException;
use Claromentis\Quiz\Facade;
use Claromentis\Quiz\Model\Poll;
use Claromentis\Quiz\Permissions\PollPermissions;
use Claromentis\Quiz\Plugin;
use Claromentis\Quiz\Repository;
use Claromentis\Core\TextUtil\ClaText;
use Psr\Http\Message\ServerRequestInterface as Request;
use RestExForbidden;
use RestExNotFound;
use RestExBadRequest;




class PollController
{
    const DEFAULT_LIMIT = 20;
    const MAX_LIMIT = 200;
    
    
    protected $formatter;
    
    
    protected $poll_permission;
    
    
    protected $lmsg;
    
    
    protected $poll_facade;
    
    
    protected $attempt_repo;
    
    
    protected $attempt_facade;
    protected ClaText $cla_text;
    public function __construct(RestFormatter $formatter, PollPermissions $poll_permissions, Lmsg $lmsg, Facade\PollFacade $poll_facade, Repository\AttemptRepository $attempt_repo, Facade\AttemptFacade $attempt_facade, ClaText $cla_text)
    {
        $this->formatter = $formatter;
        $this->poll_permission = $poll_permissions;
        $this->lmsg = $lmsg;
        $this->poll_facade = $poll_facade;
        $this->attempt_repo = $attempt_repo;
        $this->attempt_facade = $attempt_facade;
        $this->cla_text = $cla_text;
    }
    
    
    
    
    
    
    
    
    public function GetPolls(Application $_6eb6fcb92c942851e079f8ec5fb80324, Request $_b791059c94b285cdf1c90ca6f3a8f2a6, RequestData $request_data) : JsonPrettyResponse
    {
        $_7f5aa4e96d4b415a86ed72ebff677cbe = $request_data->Get($GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_7f5aa4e96d4b415" . "a86ed72ebff677cb" . "e"], $GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_4d707fab93bebb" . "00bbe69e8159697" . "c90"]);
        $_f11369824f533e8206f9ccc0c9aab3a0 = (int) $request_data->get($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_f11369824f533e8206" . "f9ccc0c9aab3a0"], self::DEFAULT_LIMIT);
        if ($_f11369824f533e8206f9ccc0c9aab3a0 > self::MAX_LIMIT) {
            $_f11369824f533e8206f9ccc0c9aab3a0 = self::MAX_LIMIT;
        }
        $_1f50e30be8c2fefa6881834e71d504a2 = $_f11369824f533e8206f9ccc0c9aab3a0 * (int) $request_data->get($GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_221da17e3055fa" . "e8d3ff516b832a5" . "f3b"], 0);
        $_54b269a12af880b045f6712e6f865462 = $request_data->Get($GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_54b269a12af8" . "80b045f6712e6" . "f865462"], $GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_4d707fab9" . "3bebb00bbe" . "69e8159697" . "c90"]);
        $user_id = $_6eb6fcb92c942851e079f8ec5fb80324->security->GetUserId();
        
        
        $poll_facade = $this->poll_facade;
        $_f1af70b59fcba61939cba0f49367d285 = $poll_facade->GetPolls($user_id, $_54b269a12af880b045f6712e6f865462, $_7f5aa4e96d4b415a86ed72ebff677cbe, $_f11369824f533e8206f9ccc0c9aab3a0, $_1f50e30be8c2fefa6881834e71d504a2);
        return new JsonPrettyResponse($_f1af70b59fcba61939cba0f49367d285);
    }
    
    
    
    
    
    
    
    
    public function GetPoll(Application $_6eb6fcb92c942851e079f8ec5fb80324, int $id) : JsonPrettyResponse
    {
        $_ed5f03d686c37933b5943f295c6b4a43 = [];
        $context = $_6eb6fcb92c942851e079f8ec5fb80324->security;
        
        
        
        
        
        
        $_876ca2097b275e704d71e00d36b3e7c5 = $this->attempt_facade;
        $poll_facade = $this->poll_facade;
        $attempt_repo = $this->attempt_repo;
        try {
            
            
            $_b3ee1ca1d7e4bff63ae777968483325d = $poll_facade->GetPoll($context, $id);
        } catch (NotFoundException $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            throw new RestExNotFound(($this->lmsg)($GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_4d23920b3dd84f98af30" . "28a8a3aa25f9"]));
        }
        $user_id = $context->GetUserId();
        $_7adc269a13af5c45b5a1caf4ec75a795 = null;
        $_2aee0ce2702cbdc0c9dfe50916d6a1d4 = 0;
        if (!$_b3ee1ca1d7e4bff63ae777968483325d->anonymous) {
            
            
            $_7adc269a13af5c45b5a1caf4ec75a795 = $_876ca2097b275e704d71e00d36b3e7c5->GetLatestAttempt($user_id, Plugin::AGGREGATION_POLL, $id);
            $_2aee0ce2702cbdc0c9dfe50916d6a1d4 = (int) $attempt_repo->CountUserAttempts($user_id, Plugin::AGGREGATION_POLL, $id);
        }
        $_b3ee1ca1d7e4bff63ae777968483325d->setDescription($this->cla_text->ParseLinks($_b3ee1ca1d7e4bff63ae777968483325d->description ?? $GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_4d707fa" . "b93bebb0" . "0bbe69e8" . "159697c9" . "0"]));
        $_ed5f03d686c37933b5943f295c6b4a43[$GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_54b269a12af880b045f6712e6f" . "865462"]] = 1;
        $_ed5f03d686c37933b5943f295c6b4a43[$GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_b3ee1ca1d7e4bff63ae777" . "968483325d"]] = $_b3ee1ca1d7e4bff63ae777968483325d;
        $_ed5f03d686c37933b5943f295c6b4a43[$GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_7adc269a13af5c" . "45b5a1caf4ec75a" . "795"]] = $_7adc269a13af5c45b5a1caf4ec75a795;
        $_ed5f03d686c37933b5943f295c6b4a43[$GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_cceda8180" . "20fabce329" . "2300389f85" . "60a"]] = $_2aee0ce2702cbdc0c9dfe50916d6a1d4;
        $_ed5f03d686c37933b5943f295c6b4a43[$GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_5630a508eaf6" . "2fdbab410362f" . "a17735c"]] = [$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_4a9a895314" . "c5571ef8262" . "129ca6a8044"] => $this->poll_permission->CanPreview($context, $_b3ee1ca1d7e4bff63ae777968483325d), $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_2622beacb6c29bde687d" . "2f80c92baef1"] => $this->poll_permission->CanAttempt($context, $_b3ee1ca1d7e4bff63ae777968483325d), $GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_0c7db5a15ed94" . "cc1be4b039915f" . "b0814"] => $this->poll_permission->CanReattempt($_b3ee1ca1d7e4bff63ae777968483325d), $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_08810531932e1a" . "6e70a95d358d14c" . "879"] => $this->poll_permission->CanManage($context, $_b3ee1ca1d7e4bff63ae777968483325d), $GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_e2a6cc9ef" . "64b3dd2175" . "7612b64b07" . "d09"] => true, $GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_b8c80e087c6f3f3d1f3c9f6" . "7bcec160d"] => $this->poll_permission->CanViewResults($context, $_b3ee1ca1d7e4bff63ae777968483325d)];
        return new JsonPrettyResponse($_ed5f03d686c37933b5943f295c6b4a43);
    }
    
    
    
    
    
    
    
    
    public function GetQuestion(Application $_6eb6fcb92c942851e079f8ec5fb80324, int $id) : JsonPrettyResponse
    {
        
        
        $poll_facade = $this->poll_facade;
        try {
            
            
            $_b3ee1ca1d7e4bff63ae777968483325d = $poll_facade->GetPoll($_6eb6fcb92c942851e079f8ec5fb80324->security, $id);
        } catch (NotFoundException $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            throw new RestExNotFound(($this->lmsg)($GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_4d23920b3dd84f98af3028a8a" . "3aa25f9"]));
        }
        return new JsonPrettyResponse([$GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["questio" . "ns"] => $_b3ee1ca1d7e4bff63ae777968483325d->getQuestion()]);
    }
    
    
    
    
    
    
    
    
    
    public function CreatePoll(Application $_6eb6fcb92c942851e079f8ec5fb80324, Request $_f47b00c53e59541a2cf6ed27c9de2a65) : JsonPrettyResponse
    {
        
        
        
        $poll_facade = $this->poll_facade;
        
        
        $_f47b00c53e59541a2cf6ed27c9de2a65 = $this->formatter->GetJson($_f47b00c53e59541a2cf6ed27c9de2a65);
        $user_id = $_6eb6fcb92c942851e079f8ec5fb80324->security->GetUserId();
        
        
        try {
            $_b3ee1ca1d7e4bff63ae777968483325d = $poll_facade->CreatePoll($_f47b00c53e59541a2cf6ed27c9de2a65, $user_id);
            $poll_id = $_b3ee1ca1d7e4bff63ae777968483325d->id ?: null;
            if ($GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_33f09d76394b074b77926" . "5f857d5ec8a"]($_f47b00c53e59541a2cf6ed27c9de2a65[$GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["ques" . "tion"]]) > 1) {
                throw new \InvalidArgumentException($GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_2e8e0758094679b3cb5" . "171c8c3d880f6"]);
            }
            $_f47b00c53e59541a2cf6ed27c9de2a65[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["ques" . "tion"]] = $GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_f2d4162" . "7f09270f" . "0dbd21d2" . "7e02868d" . "7"]($_f47b00c53e59541a2cf6ed27c9de2a65[$GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["questi" . "on"]]);
            $poll_facade->CreateQuestionForPoll($_f47b00c53e59541a2cf6ed27c9de2a65, $poll_id, $user_id);
            
            
            $_bc03a57aecaf90d056bc199b3782d415 = $poll_facade->GetPoll($_6eb6fcb92c942851e079f8ec5fb80324->security, $poll_id, true);
            
            
        } catch (NotFoundException $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            throw new RestExNotFound($_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage());
        } catch (PermissionException $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            throw new RestExForbidden($_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage(), $GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_79bd87060993ff622ef212c1e" . "8b6a79a"], $_fe441aa3ef350bfb1a1a1ad8520dd530);
        }
        return new JsonPrettyResponse([$GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_f1af70b59fcba61939cba0f49367" . "d285"] => [$_bc03a57aecaf90d056bc199b3782d415], $GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_f4eafa5f493306ffdb51a6" . "88b21dd507"] => $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_33f09d76394b074b779265f857" . "d5ec8a"]($_bc03a57aecaf90d056bc199b3782d415)]);
    }
    
    
    
    
    
    
    
    
    
    
    
    
    public function EditPoll(Application $_6eb6fcb92c942851e079f8ec5fb80324, Request $_f47b00c53e59541a2cf6ed27c9de2a65, int $id) : JsonPrettyResponse
    {
        
        
        $poll_facade = $this->poll_facade;
        $_f47b00c53e59541a2cf6ed27c9de2a65 = $this->formatter->GetJson($_f47b00c53e59541a2cf6ed27c9de2a65);
        try {
            $poll_facade->EditPoll($id, $_f47b00c53e59541a2cf6ed27c9de2a65);
            if ($GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_33f09d76394b074b7792" . "65f857d5ec8a"]($_f47b00c53e59541a2cf6ed27c9de2a65[$GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["ques" . "tion"]]) > 1) {
                throw new \InvalidArgumentException($GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_2e8e0758094679" . "b3cb5171c8c3d88" . "0f6"]);
            }
            $_f47b00c53e59541a2cf6ed27c9de2a65[$GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["questio" . "n"]] = $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_f2d4162" . "7f09270f" . "0dbd21d2" . "7e02868d" . "7"]($_f47b00c53e59541a2cf6ed27c9de2a65[$GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["que" . "sti" . "on"]]);
            $_f47b00c53e59541a2cf6ed27c9de2a65[$GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["po" . "ll" . "_i" . "d"]] = $id;
            $user_id = $_6eb6fcb92c942851e079f8ec5fb80324->security->GetUserId();
            
            
            $poll_facade->EditQuestionPoll($_f47b00c53e59541a2cf6ed27c9de2a65, $user_id);
        } catch (NotFoundException $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            throw new RestExNotFound($_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage());
        } catch (\InvalidArgumentException $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            throw new \RestExBadRequest($_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage());
        }
        return new JsonPrettyResponse([$GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_f1af70b59fcba61939cba0f49367d" . "285"] => $poll_facade->GetPoll($_6eb6fcb92c942851e079f8ec5fb80324->security, $id, true)]);
    }
    
    
    
    
    
    
    
    
    
    public function DeletePoll(Application $_6eb6fcb92c942851e079f8ec5fb80324, int $id) : JsonPrettyResponse
    {
        
        
        $poll_facade = $this->poll_facade;
        try {
            $_4b5e91a0a6f7f822ac389ad9a3fb0ee2 = $poll_facade->DeletePoll($id);
        } catch (\Exception $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            throw new \RestExNotFound($_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage());
        }
        return new JsonPrettyResponse([$GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_54b269a12af880b04" . "5f6712e6f865462"] => $_4b5e91a0a6f7f822ac389ad9a3fb0ee2]);
    }
    
    
    
    
    
    
    
    
    
    
    
    
    public function CreateQuestion(Application $_6eb6fcb92c942851e079f8ec5fb80324, Request $_f47b00c53e59541a2cf6ed27c9de2a65, int $id) : JsonPrettyResponse
    {
        
        
        $poll_facade = $this->poll_facade;
        
        
        try {
            $poll_facade->GetPoll($_6eb6fcb92c942851e079f8ec5fb80324->security, $id, true);
            
            
            $_f47b00c53e59541a2cf6ed27c9de2a65 = $this->formatter->GetJson($_f47b00c53e59541a2cf6ed27c9de2a65);
            $user_id = $_6eb6fcb92c942851e079f8ec5fb80324->security->GetUserId();
            
            
            $_f47b00c53e59541a2cf6ed27c9de2a65[$GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["i" . "d"]] = $user_id;
            $_f47b00c53e59541a2cf6ed27c9de2a65 = [$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["ques" . "tion"] => $_f47b00c53e59541a2cf6ed27c9de2a65];
            
            
            $poll_facade->CreateQuestionForPoll($_f47b00c53e59541a2cf6ed27c9de2a65, $id, $user_id);
            
            
            $question = $poll_facade->GetQuestionForPoll($id, true);
        } catch (NotFoundException $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            throw new \RestExNotFound($_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage());
        } catch (\InvalidArgumentException $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            throw new \RestExBadRequest($_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage());
        } catch (PermissionException $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            throw new \RestExForbidden($_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage());
        }
        return new JsonPrettyResponse([$GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["quest" . "ion"] => $question]);
    }
    
    
    
    
    
    
    
    
    
    
    public function UpdateQuestion(Application $_6eb6fcb92c942851e079f8ec5fb80324, Request $_f47b00c53e59541a2cf6ed27c9de2a65, int $id) : JsonPrettyResponse
    {
        
        
        
        $poll_facade = $this->poll_facade;
        
        
        try {
            
            
            $_f47b00c53e59541a2cf6ed27c9de2a65 = $this->formatter->GetJson($_f47b00c53e59541a2cf6ed27c9de2a65);
            
            
            $question = $poll_facade->GetQuestionForPoll($id);
            
            
            if (empty($question)) {
                throw new NotFoundException(($this->lmsg)($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_d054d8ac9359ad62ec6ae6a8e1" . "08b578"]));
            }
            
            
            $question = $GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_f2d41627f09270f0dbd21d27e02" . "868d7"]($question);
            $_f47b00c53e59541a2cf6ed27c9de2a65[$GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["i" . "d"]] = $question->GetId();
            $_f47b00c53e59541a2cf6ed27c9de2a65 = [$GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["que" . "sti" . "on"] => $_f47b00c53e59541a2cf6ed27c9de2a65];
            $context = $_6eb6fcb92c942851e079f8ec5fb80324->security;
            $user_id = $context->GetUserId();
            
            
            $question = $poll_facade->EditQuestionPoll($_f47b00c53e59541a2cf6ed27c9de2a65, $user_id);
        } catch (NotFoundException $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            throw new \RestExNotFound($_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage());
        } catch (\InvalidArgumentException $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            throw new \RestExBadRequest($_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage());
        }
        return new JsonPrettyResponse([$GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["ques" . "tion"] => $question]);
    }
    
    
    
    
    
    
    
    public function DeleteQuestion(Application $_6eb6fcb92c942851e079f8ec5fb80324, int $id) : JsonPrettyResponse
    {
        
        
        $poll_facade = $this->poll_facade;
        $_4b43208a06070ee322599b3bb988db75 = $poll_facade->DeleteQuestion($id);
        return new JsonPrettyResponse([$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_54b269a12af880b045f6712e6" . "f865462"] => $_4b43208a06070ee322599b3bb988db75]);
    }
    
    
    
    
    
    
    
    public function SearchQuestions(Application $_6eb6fcb92c942851e079f8ec5fb80324, RequestData $request_data) : JsonPrettyResponse
    {
        
        
        
        
        
        $_864ec8f1fa467c206b6bb2b9c0f308bf = $_6eb6fcb92c942851e079f8ec5fb80324[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_4196faadc878e30e23a" . "63bd8ff6d84a9"]];
        $poll_facade = $this->poll_facade;
        $_a2c1535293d134e078c87c81de95f1d1 = $request_data->Get($GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_a2c1535293d134e078c87c81de95f1" . "d1"]);
        $questions = $_864ec8f1fa467c206b6bb2b9c0f308bf->Search($_a2c1535293d134e078c87c81de95f1d1);
        
        
        foreach ($questions as $question) {
            $options = $poll_facade->GetOptionsForQuestion($question);
            foreach ($options as $_ab3f4d20f08bd694b2839e5c36c149a2) {
                $_ab3f4d20f08bd694b2839e5c36c149a2->show_sensitive = true;
            }
            $question->SetOptions($options);
        }
        return new JsonPrettyResponse($questions);
    }
    
    
    
    
    
    
    
    
    
    
    public function GetAttempts(Application $_6eb6fcb92c942851e079f8ec5fb80324, int $id, int $object_type, RequestData $data) : JsonPrettyResponse
    {
        try {
            $_64666bcf1e5aaa07774f3d7439ff264d = $data->Get($GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_64666bcf1e5aaa07774f3d7439" . "ff264d"]);
        } catch (RequestDataException $_c35473364fa7a050299058f332ec29c1) {
            throw new RestExBadRequest($_c35473364fa7a050299058f332ec29c1->getMessage(), $GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_c894747360c6ec5bd8169" . "530eaf9c473"], $_c35473364fa7a050299058f332ec29c1);
        }
        
        
        $_9fefbd062970af83dc4cc0837cee7d3d = $this->attempt_repo;
        
        
        $poll_facade = $this->poll_facade;
        try {
            $poll_facade->GetPoll($_6eb6fcb92c942851e079f8ec5fb80324->security, $id, true);
        } catch (NotFoundException $_c35473364fa7a050299058f332ec29c1) {
            throw new \RestExNotFound(($this->lmsg)($GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_4d23920b3dd84f98af" . "3028a8a3aa25f9"]));
        }
        
        
        if ((int) $_64666bcf1e5aaa07774f3d7439ff264d === 0) {
            $_e6c850126cff293d170e2d7ab4e2aad4 = $_9fefbd062970af83dc4cc0837cee7d3d->GetAttempts($object_type, $id, false, false, $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_9137964f9a338e89f979757c23fc" . "020d"], 25);
            $_cceda818020fabce3292300389f8560a = $_9fefbd062970af83dc4cc0837cee7d3d->CountAttempts($object_type, $id, false);
        } else {
            $_e6c850126cff293d170e2d7ab4e2aad4 = $_9fefbd062970af83dc4cc0837cee7d3d->GetAttempts($object_type, $id, null, false, $GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_9137964f9a338e8" . "9f979757c23fc020" . "d"], 25);
            $_cceda818020fabce3292300389f8560a = $_9fefbd062970af83dc4cc0837cee7d3d->CountAttempts($object_type, $id);
        }
        return new JsonPrettyResponse([$GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_54b269a12af" . "880b045f6712" . "e6f865462"] => 1, $GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_e6c850126cff293d170e2d7ab4e2aad" . "4"] => $_e6c850126cff293d170e2d7ab4e2aad4, $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_f4eafa5" . "f493306f" . "fdb51a68" . "8b21dd50" . "7"] => $_cceda818020fabce3292300389f8560a]);
    }
}