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

$GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"] ?: array()) + array("_0c5123aa7" . "44f69bbc0e" . "8b3ea2f6e8" . "47d" => base64_decode("bG1zZ" . "w=="), "_a6cb83fdacd366dfe0d" . "a33afe934397a" => base64_decode("cXVpe" . "l9wcm" . "V2aWV" . "3"), "_ada909094c3f2b48f2ba66b" . "ec3334aab" => base64_decode("cXVpei5mYWNhZGUucXVpe" . "g=="), "_378a2afc2803a91e1b7526bbba78567" . "2" => base64_decode("cXVpei5lcnJvci5ub3RfZ" . "m91bmQ="), "_556c6740a7c938ba7b49" . "ba50f10cf12d" => base64_decode("cXVpei5lcnJvci5ub19w" . "cmV2aWV3X3Blcm1z"));
use Claromentis\Core\Application;
use Claromentis\Core\Http\JsonPrettyResponse;
use Claromentis\Core\Repository\Exception\NotFoundException;
use Claromentis\Quiz\Facade;
use Claromentis\Quiz\Permissions\QuizPermissions;
use RestExForbidden;
use RestExNotFound;
use RestFormat;
use Symfony\Component\HttpFoundation\JsonResponse;









class AdminController
{
    
    
    
    
    protected $formatter;
    
    
    
    
    
    
    public function __construct(RestFormat $formatter)
    {
        $this->formatter = $formatter;
    }
    
    
    
    
    
    
    
    
    
    
    public function Preview(Application $_6eb6fcb92c942851e079f8ec5fb80324, $quiz_id)
    {
        
        
        
        
        $_876ca2097b275e704d71e00d36b3e7c5 = $_6eb6fcb92c942851e079f8ec5fb80324[$GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_ada9090" . "94c3f2b4" . "8f2ba66b" . "ec3334aa" . "b"]];
        try {
            $quiz = $_876ca2097b275e704d71e00d36b3e7c5->GetEntireQuiz($quiz_id);
        } catch (NotFoundException $_c35473364fa7a050299058f332ec29c1) {
            throw new RestExNotFound($GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_0c5123aa744f69bbc0e8b" . "3ea2f6e847d"]($GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_378a2afc2803a91e1b7526bbba" . "785672"]));
        }
        if (!QuizPermissions::CanPreview($_6eb6fcb92c942851e079f8ec5fb80324->acl, $_6eb6fcb92c942851e079f8ec5fb80324->security, $quiz)) {
            throw new RestExForbidden($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_0c5123a" . "a744f69b" . "bc0e8b3e" . "a2f6e847" . "d"]($GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_556c6740a7c938ba7" . "b49ba50f10cf12d"]));
        }
        $_6eb6fcb92c942851e079f8ec5fb80324->session->set($GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_a6cb83fd" . "acd366dfe" . "0da33afe9" . "34397a"], $quiz_id);
        return new JsonPrettyResponse(array());
    }
    
    
    
    
    
    
    
    public function StopPreview(Application $_6eb6fcb92c942851e079f8ec5fb80324)
    {
        $_6eb6fcb92c942851e079f8ec5fb80324->session->remove($GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_a6cb83fdac" . "d366dfe0da3" . "3afe934397a"]);
        return new JsonPrettyResponse(array());
    }
}