<?php
namespace Claromentis\Pages\TrashCan;

$GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"] ?: array()) + array("_a591754a8ddcdbda9c80f1db4d911e1" . "4" => base64_decode("aXNfbnV" . "sbA=="), "_1774daf8217eb41295b1c5c7f6" . "2288a8" => base64_decode("cGFnZXMu" . "c2l0ZV9y" . "ZXBvc2l0" . "b3J5"), "_eb779b337822cd65a" . "e4cebc06f538746" => base64_decode("VHJhc2hPYmplY3RTaXRlOjpDcmVhdGVGcm9tT2JqZWN0KCkg" . "YWNjZXB0cyBvbmx5IG9iamVjdCBvZiBjbGFzcyBTaXRl"), "_1dd1262b8576e1f35064b" . "bd227ec4fe1" => base64_decode("cGFnZXMubWVu" . "dV9pdGVtX3Jl" . "cG9zaXRvcnk="), "_0c5123aa744f69bbc0e8b3ea2" . "f6e847d" => base64_decode("bG1zZw" . "=="), "_bc4d90d" . "74ec71b0" . "33b521d9" . "4df2593c" . "b" => base64_decode("ZnV" . "sbF" . "91c" . "mw="), "_ac08053b98d00b584a1c66881facea7" . "0" => base64_decode("cGFnZXMudHJhc" . "2guc2l0ZV9pdG" . "Vt"), "_f303bb2ed1de367a36ee7f5" . "66e245508" => base64_decode("cGFnZXMudXNlX2Nhc2UuZGVsZXR" . "lX3NpdGU="));
use Claromentis\Core\Services;
use Claromentis\Core\TextUtil\ClaText;
use Claromentis\Pages\Exception\AccessDeniedException;
use Claromentis\Pages\Model\MenuItem;
use Claromentis\Pages\Model\Site;
use Claromentis\Pages\Perm;
use Claromentis\Pages\Repository\MenuItemRepository;
use Claromentis\Pages\Repository\SiteRepository;
use Claromentis\Pages\Repository\UrlRepository;
use Claromentis\Pages\UseCase;
class TrashObjectSite extends TrashObjectPages
{
    protected ClaText $cla_text;
    protected UrlRepository $url_repository;
    protected SiteRepository $site_repository;
    protected MenuItemRepository $menu_item_repository;
    
    
    
    
    
    
    public function __construct($_b15aac3aa29c10ea6d1228f58cb9a7e8 = null)
    {
        $this->cla_text = Services::I()->{ClaText::class};
        $this->url_repository = Services::I()->{UrlRepository::class};
        $this->site_repository = Services::I()->{$GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_1774daf8217eb412" . "95b1c5c7f62288a8"]};
        $this->menu_item_repository = Services::I()->{$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_1dd1262b8576e1f35064bb" . "d227ec4fe1"]};
        $this->aggregation = Perm::AGGREGATION_PAGES_SITE;
        if (!$GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_a591754a8ddcdbda9c80f1db4d91" . "1e14"]($_b15aac3aa29c10ea6d1228f58cb9a7e8) && $_b15aac3aa29c10ea6d1228f58cb9a7e8 instanceof Site) {
            $this->CreateFromObject($_b15aac3aa29c10ea6d1228f58cb9a7e8);
        }
    }
    public function CreateFromObject($_b15aac3aa29c10ea6d1228f58cb9a7e8)
    {
        if (!$_b15aac3aa29c10ea6d1228f58cb9a7e8 instanceof Site) {
            throw new \InvalidArgumentException($GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_eb779b337" . "822cd65ae4" . "cebc06f538" . "746"]);
        }
        $url = $this->url_repository->Get($_b15aac3aa29c10ea6d1228f58cb9a7e8->url_id);
        $this->site_id = $_b15aac3aa29c10ea6d1228f58cb9a7e8->id;
        $this->obj_id = $_b15aac3aa29c10ea6d1228f58cb9a7e8->id;
        $this->description = $this->cla_text->TrimLongString($url->GetProperty($GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_bc4d90d74ec71b033b521d94df2" . "593cb"]), 300);
        $this->title = $this->cla_text->TrimLongString($_b15aac3aa29c10ea6d1228f58cb9a7e8->title, 50);
        $this->type = self::TRASH_TYPE_SITE;
    }
    public function GetObjectTypeName()
    {
        return $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_0c5123aa744f69bbc0e8b3ea2f" . "6e847d"]($GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_ac08053b98d00b584a1c66" . "881facea70"]);
    }
    
    
    
    
    
    
    
    
    
    public function DeleteCompletely() : bool
    {
        
        
        $use_case = Services::I()->{$GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_f303bb2ed1de367a36ee7" . "f566e245508"]};
        try {
            $_ad6d1395fad94fb16ed12d8007727518 = $this->site_repository->GetById($this->obj_id);
            
            
            if ($_ad6d1395fad94fb16ed12d8007727518 === null) {
                return false;
            }
            $use_case->FullDelete($_ad6d1395fad94fb16ed12d8007727518);
        } catch (AccessDeniedException $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            return false;
        }
        return true;
    }
}