<?php
namespace Claromentis\Pages\UseCase;

$GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"] ?: array()) + array("_d755e6ec9" . "9b390064b9" . "c56193eb4a" . "c7f" => base64_decode("RmFpbGVkIHRvIGZpbmQgQ2F0" . "ZWdvcnkgSW5kZXg="));
use Claromentis\Core\Security\SecurityContext;
use Claromentis\Pages\Category\PagesCategories;
use Claromentis\Pages\Exception\AccessDeniedException;
use Claromentis\Pages\Exception\CategoryInvalidSortException;
use Claromentis\Pages\Exception\CategoryRuntimeException;
use Claromentis\Pages\Exception\PageNotFoundException;
use Claromentis\Pages\PagesAcl;
use Claromentis\Pages\Category\PagesComponentsCategories;
use LogicException;
class GetCategories
{
    private $pages_acl;
    private $pages_categories;
    private $pages_components_categories;
    
    
    
    
    
    
    
    
    public function __construct(PagesAcl $pages_acl, PagesCategories $_5680264026c132f27a79716f664f00db, PagesComponentsCategories $_bc3504ed4df74a169736063a47a64045)
    {
        $this->pages_acl = $pages_acl;
        $this->pages_categories = $_5680264026c132f27a79716f664f00db;
        $this->pages_components_categories = $_bc3504ed4df74a169736063a47a64045;
    }
    
    
    
    
    
    
    
    
    
    
    
    public function GetCategories(SecurityContext $security_context, bool $_2b39ab477b13830a54b0ba0ada25cbd7 = true, bool $_f098127274322059a98331869c1b4724 = true, ?array $_f6a16426f3b3f03ad6bacec912eec291 = null) : array
    {
        if (!$this->pages_acl->CanViewCategories($security_context)) {
            throw new AccessDeniedException();
        }
        if ($_2b39ab477b13830a54b0ba0ada25cbd7 && $_f098127274322059a98331869c1b4724) {
            return $this->pages_categories->GetCategoriesProperties($_f6a16426f3b3f03ad6bacec912eec291);
        }
        if ($_2b39ab477b13830a54b0ba0ada25cbd7) {
            return $this->pages_components_categories->GetPopulatedCategories($_f6a16426f3b3f03ad6bacec912eec291);
        }
        if ($_f098127274322059a98331869c1b4724) {
            return $this->pages_components_categories->GetEmptyCategories($_f6a16426f3b3f03ad6bacec912eec291);
        }
        return [];
    }
    
    
    
    
    
    
    
    public function GetCategory(SecurityContext $security_context, $_1cb0853fbfae1a857fd0ecf1f183e45a) : array
    {
        if (!$this->pages_acl->CanViewCategories($security_context)) {
            throw new AccessDeniedException();
        }
        try {
            return $this->pages_categories->GetCategoryProperties($_1cb0853fbfae1a857fd0ecf1f183e45a);
        } catch (CategoryRuntimeException $_cf8ea36c946a24f2b6b1a830b08368dd) {
            throw new PageNotFoundException($GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_d755e6ec99b390064b9c" . "56193eb4ac7f"], null, $_cf8ea36c946a24f2b6b1a830b08368dd);
        }
    }
}