<?php
namespace Claromentis\Pages\TrashCan;

$GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"] ?: array()) + array("_bc4d90d74ec71b033b52" . "1d94df2593cb" => base64_decode("ZnVs" . "bF91" . "cmw="), "_f303bb2ed1de367a36ee" . "7f566e245508" => base64_decode("cGFnZXMudXNlX2Nhc2U" . "uZGVsZXRlX3NpdGU="), "_eb779b3378" . "22cd65ae4ce" . "bc06f538746" => base64_decode("VHJhc2hPYmplY3RTaXRlOjpDcmVhdGVGcm9tT" . "2JqZWN0KCkgYWNjZXB0cyBvbmx5IG9iamVjdC" . "BvZiBjbGFzcyBTaXRl"), "_ac08053b98d00b584a1c668" . "81facea70" => base64_decode("cGFnZXMudHJhc2gu" . "c2l0ZV9pdGVt"), "_1dd1262b8576e1f35064bbd" . "227ec4fe1" => base64_decode("cGFnZXMubWVudV9pdGVtX3JlcG9z" . "aXRvcnk="), "_a591754a8ddcdbda9c80f1db4d911e1" . "4" => base64_decode("aXNfbnVsb" . "A=="), "_0c5123aa744f" . "69bbc0e8b3ea2" . "f6e847d" => base64_decode("bG1" . "zZw" . "=="), "_1774daf8217eb41295b1c5c7f62" . "288a8" => base64_decode("cGFnZXMuc2l0ZV9yZXBvc2l0" . "b3J5"));
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["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_1774daf8217eb412" . "95b1c5c7f62288a8"]};
        $this->menu_item_repository = Services::I()->{$GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_1dd1262b8576e1f3" . "5064bbd227ec4fe1"]};
        $this->aggregation = Perm::AGGREGATION_PAGES_SITE;
        if (!$GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_a591754a8ddcdbda" . "9c80f1db4d911e14"]($_b15aac3aa29c10ea6d1228f58cb9a7e8) && $_b15aac3aa29c10ea6d1228f58cb9a7e8 instanceof Site) {
            $this->CreateFromObject($_b15aac3aa29c10ea6d1228f58cb9a7e8);
        }
    }
    public function CreateFromObject($_b15aac3aa29c10ea6d1228f58cb9a7e8)
    {
        if (!$_b15aac3aa29c10ea6d1228f58cb9a7e8 instanceof Site) {
            throw new \InvalidArgumentException($GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_eb779b337822cd65ae4ceb" . "c06f538746"]);
        }
        $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["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_bc4d90d74ec71b033b521d94" . "df2593cb"]), 300);
        $this->title = $this->cla_text->TrimLongString($_b15aac3aa29c10ea6d1228f58cb9a7e8->title, 50);
        $this->type = self::TRASH_TYPE_SITE;
    }
    public function GetObjectTypeName()
    {
        return $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_0c5123aa744f69bbc0e8b3ea2f6e847" . "d"]($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_ac08053b98d00b584a1c66881" . "facea70"]);
    }
    
    
    
    
    
    
    
    
    
    public function DeleteCompletely() : bool
    {
        
        
        $use_case = Services::I()->{$GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_f303bb2ed1de367a36ee7f566e" . "245508"]};
        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;
    }
}