<?php
namespace Claromentis\Pages\Controller;

$GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"] ?: array()) + array("_03e9164d0a343b" . "742df4793268b80" . "767" => base64_decode("Zmlsd" . "GVy"), "_8dabb06efc95df4c" . "ff7c4afe91857b53" => base64_decode("bmFtZQ=" . "="), "_374443c" . "15144705" . "aeb4aea1" . "eb92ba61" . "9" => base64_decode("Q291bGQgbm90IGxpc3QgY2F0ZWdvcmllcywgUXVlcnkgU3RyaW5nIEZpZWxkICdGaWx0ZXInIHZhbHVlIG11c3QgYmUgZWl0aGVyICdhbG" . "wnLCAncG9wdWxhdGVkJyBvciAnZW1wdHkn"), "_582f9ec72b126fca8" . "3e47750ff7f619f" => base64_decode("cG9wdWxhdGV" . "k"), "_aec8cca2f" . "0249f3accf" . "393bc28560" . "8af" => base64_decode("Q2F0ZWdvc" . "nkgbm90IG" . "ZvdW5k"), "_c4aca92597" . "dd88774c8cf" . "e7ac4ec7eb6" => base64_decode("c29ydF9ie" . "Q=="), "_d5674e232cdb7547c2679" . "cdae24c7de6" => base64_decode("Q291bGQgbm90IExpc3QgQ29tcG9uZW50IENhdGVnb3JpZX" . "MsIFF1ZXJ5IFN0cmluZyBGaWVsZCAnc29ydF9ieScgdmFs" . "dWUgbXVzdCBiZSBlaXRoZXIgJ25hbWUnLCAnZGVzY3JpcH" . "Rpb24nIG9yIHVuZGVmaW5lZA=="), "_70979d287fa2c98d21aa07834c259a" . "52" => base64_decode("c3RydG9sb3d" . "lcg=="), "_98b180ae98b449777b6d173" . "8de0d7f2c" => base64_decode("ZGlyZW" . "N0aW9u"), "_aec3ab62f1e" . "8f2dc912b9ad" . "483900aff" => base64_decode("ZW1w" . "dHk="), "_faeb739cfde8d2db2578" . "9d857259b877" => base64_decode("c29ydF9kaXJlY3R" . "pb24="), "_1ac0335a1f605e21" . "6d9ffde5545a81e3" => base64_decode("YWx" . "s"));
use Claromentis\Core\Http\JsonPrettyResponse;
use Claromentis\Core\Security\SecurityContext;
use Claromentis\Pages\Exception\AccessDeniedException;
use Claromentis\Pages\Exception\CategoryInvalidSortException;
use Claromentis\Pages\Exception\PageNotFoundException;
use Claromentis\Pages\Exception\SortException;
use Claromentis\Pages\Exception\SortIndexDirectionException;
use Claromentis\Pages\Exception\SortIndexNameException;
use Claromentis\Pages\UseCase\GetCategories;
use LogicException;
use Psr\Http\Message\ServerRequestInterface;
use RestExBadRequest;
use RestExForbidden;
use RestExNotFound;
class CategoriesRestV2
{
    
    
    
    
    
    
    
    
    
    
    public function GetCategories(SecurityContext $security_context, GetCategories $use_case, ServerRequestInterface $_b791059c94b285cdf1c90ca6f3a8f2a6) : JsonPrettyResponse
    {
        $_2dfb61d699ec2116e515ca19adfa38bc = $_b791059c94b285cdf1c90ca6f3a8f2a6->getQueryParams();
        $_c4aca92597dd88774c8cfe7ac4ec7eb6 = $_2dfb61d699ec2116e515ca19adfa38bc[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_c4aca92597dd88774c" . "8cfe7ac4ec7eb6"]] ?? null;
        $_faeb739cfde8d2db25789d857259b877 = $_2dfb61d699ec2116e515ca19adfa38bc[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_faeb739cf" . "de8d2db257" . "89d857259b" . "877"]] ?? null;
        $_03e9164d0a343b742df4793268b80767 = $GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_70979d287fa2c98d21aa0" . "7834c259a52"]($_2dfb61d699ec2116e515ca19adfa38bc[$GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_03e9164d0a343b742d" . "f4793268b80767"]] ?? $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_1ac0335a1f605e2" . "16d9ffde5545a81e" . "3"]);
        $_1f79bd29ee81c9194d399419ba379de5 = false;
        $_b6d0c99721d05d09c89fe9b181db77e1 = false;
        switch ($_03e9164d0a343b742df4793268b80767) {
            case $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_1ac0335a1f6" . "05e216d9ffde" . "5545a81e3"]:
                $_1f79bd29ee81c9194d399419ba379de5 = true;
                $_b6d0c99721d05d09c89fe9b181db77e1 = true;
                break;
            case $GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_582f9ec72b126fca83e4" . "7750ff7f619f"]:
                $_1f79bd29ee81c9194d399419ba379de5 = true;
                break;
            case $GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_aec3ab62f1e8f2dc912b9ad48390" . "0aff"]:
                $_b6d0c99721d05d09c89fe9b181db77e1 = true;
                break;
            default:
                throw new RestExBadRequest($GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_374443c15144705a" . "eb4aea1eb92ba619"]);
        }
        $_f6a16426f3b3f03ad6bacec912eec291 = null;
        if (isset($_c4aca92597dd88774c8cfe7ac4ec7eb6)) {
            $_f6a16426f3b3f03ad6bacec912eec291 = [$GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_8dabb06" . "efc95df4" . "cff7c4af" . "e91857b5" . "3"] => $_c4aca92597dd88774c8cfe7ac4ec7eb6, $GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_98b180ae98b449777b6d1" . "738de0d7f2c"] => $_faeb739cfde8d2db25789d857259b877];
        }
        try {
            $_006a00786ba8fa97908790a83741c8d8 = $use_case->GetCategories($security_context, $_1f79bd29ee81c9194d399419ba379de5, $_b6d0c99721d05d09c89fe9b181db77e1, $_f6a16426f3b3f03ad6bacec912eec291);
        } catch (AccessDeniedException $_ae55b4d8cc51cfc4077f7e578d6db976) {
            throw new RestExForbidden(null, null, $_ae55b4d8cc51cfc4077f7e578d6db976);
        } catch (CategoryInvalidSortException $_45b0d0f4e8d8381405a926c71fc866b2) {
            throw new RestExBadRequest($GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_d5674e232cdb7547c2679cdae24c7d" . "e6"], null, $_45b0d0f4e8d8381405a926c71fc866b2);
        }
        return new JsonPrettyResponse($_006a00786ba8fa97908790a83741c8d8);
    }
    
    
    
    
    
    
    
    
    
    public function GetCategory(SecurityContext $security_context, GetCategories $use_case, $_1cb0853fbfae1a857fd0ecf1f183e45a) : JsonPrettyResponse
    {
        try {
            return new JsonPrettyResponse($use_case->GetCategory($security_context, $_1cb0853fbfae1a857fd0ecf1f183e45a));
        } catch (PageNotFoundException $_e35cfae477cc5aa93baf901369a8a588) {
            throw new RestExNotFound($GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_aec8cca2f0249f3a" . "ccf393bc285608af"], null, $_e35cfae477cc5aa93baf901369a8a588);
        } catch (AccessDeniedException $_ae55b4d8cc51cfc4077f7e578d6db976) {
            throw new RestExForbidden(null, null, $_ae55b4d8cc51cfc4077f7e578d6db976);
        }
    }
}