<?php
namespace Claromentis\Pages\Controller;

$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"] = (@$GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"] ?: array()) + array("_aec3ab62f1e8f2dc912b9ad483" . "900aff" => base64_decode("ZW1w" . "dHk="), "_aec8cca" . "2f0249f3" . "accf393b" . "c285608a" . "f" => base64_decode("Q2F0ZW" . "dvcnkg" . "bm90IG" . "ZvdW5k"), "_98b180ae98b4497" . "77b6d1738de0d7f2" . "c" => base64_decode("ZGlyZ" . "WN0aW" . "9u"), "_70979d287fa2c98d21aa07834c2" . "59a52" => base64_decode("c3RydG9sb3dlc" . "g=="), "_582f9ec72b126fca83e47750ff" . "7f619f" => base64_decode("cG9wdWxh" . "dGVk"), "_03e9164d0a343b742df479326" . "8b80767" => base64_decode("Zm" . "ls" . "dG" . "Vy"), "_374443c15144705aeb4aea1eb92ba61" . "9" => base64_decode("Q291bGQgbm90IGxpc3QgY2F0ZWdvcmllcywgUXVlcnk" . "gU3RyaW5nIEZpZWxkICdGaWx0ZXInIHZhbHVlIG11c3" . "QgYmUgZWl0aGVyICdhbGwnLCAncG9wdWxhdGVkJyBvc" . "iAnZW1wdHkn"), "_c4aca92597dd88774c8cfe7ac4e" . "c7eb6" => base64_decode("c29" . "ydF" . "9ie" . "Q=="), "_faeb739cfd" . "e8d2db25789" . "d857259b877" => base64_decode("c29ydF9k" . "aXJlY3Rp" . "b24="), "_1ac0335a1" . "f605e216d9" . "ffde5545a8" . "1e3" => base64_decode("Y" . "W" . "x" . "s"), "_d5674e232cdb75" . "47c2679cdae24c7" . "de6" => base64_decode("Q291bGQgbm90IExpc3QgQ29tcG9uZW50IENhdGVnb3JpZXMsIFF1ZXJ5I" . "FN0cmluZyBGaWVsZCAnc29ydF9ieScgdmFsdWUgbXVzdCBiZSBlaXRoZX" . "IgJ25hbWUnLCAnZGVzY3JpcHRpb24nIG9yIHVuZGVmaW5lZA=="), "_8dabb06efc95df" . "4cff7c4afe91857" . "b53" => base64_decode("bmFtZQ=" . "="));
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"]["_c4aca92597dd8877" . "4c8cfe7ac4ec7eb6"]] ?? null;
        $_faeb739cfde8d2db25789d857259b877 = $_2dfb61d699ec2116e515ca19adfa38bc[$GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_faeb739cfde8d2db25789d857259b8" . "77"]] ?? null;
        $_03e9164d0a343b742df4793268b80767 = $GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_70979d287fa2c98d21aa07834c2" . "59a52"]($_2dfb61d699ec2116e515ca19adfa38bc[$GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_03e9164d0a3" . "43b742df4793" . "268b80767"]] ?? $GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_1ac0335a1f605e216d9ffde" . "5545a81e3"]);
        $_1f79bd29ee81c9194d399419ba379de5 = false;
        $_b6d0c99721d05d09c89fe9b181db77e1 = false;
        switch ($_03e9164d0a343b742df4793268b80767) {
            case $GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_1ac0335a1f" . "605e216d9ff" . "de5545a81e3"]:
                $_1f79bd29ee81c9194d399419ba379de5 = true;
                $_b6d0c99721d05d09c89fe9b181db77e1 = true;
                break;
            case $GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_582f9ec72b126fca83" . "e47750ff7f619f"]:
                $_1f79bd29ee81c9194d399419ba379de5 = true;
                break;
            case $GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_aec3ab6" . "2f1e8f2d" . "c912b9ad" . "483900af" . "f"]:
                $_b6d0c99721d05d09c89fe9b181db77e1 = true;
                break;
            default:
                throw new RestExBadRequest($GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_374443c15144705aeb4aea1" . "eb92ba619"]);
        }
        $_f6a16426f3b3f03ad6bacec912eec291 = null;
        if (isset($_c4aca92597dd88774c8cfe7ac4ec7eb6)) {
            $_f6a16426f3b3f03ad6bacec912eec291 = [$GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_8dabb06efc95" . "df4cff7c4afe9" . "1857b53"] => $_c4aca92597dd88774c8cfe7ac4ec7eb6, $GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_98b180ae98b449777b6d1738d" . "e0d7f2c"] => $_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["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_d5674e23" . "2cdb7547c" . "2679cdae2" . "4c7de6"], 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["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_aec8cca2f0249f3accf393bc285608a" . "f"], null, $_e35cfae477cc5aa93baf901369a8a588);
        } catch (AccessDeniedException $_ae55b4d8cc51cfc4077f7e578d6db976) {
            throw new RestExForbidden(null, null, $_ae55b4d8cc51cfc4077f7e578d6db976);
        }
    }
}