<?php
namespace Claromentis\Projects\Subscribers;

$GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"] ?: array()) + array("_ec7bca63c7f21ec28553dc2fc0e176e" . "0" => base64_decode("T25QcmV" . "EZWxldG" . "U="), "_8dabb06efc95df4cff7c4afe9185" . "7b53" => base64_decode("bm" . "Ft" . "ZQ" . "=="), "_d638e3756ec5958b0e070cee488d" . "3abf" => base64_decode("cHJvamVjdHMuZmlsZXMuY2FudF9kZ" . "WxldGVfcm9vdF9mb2xkZXI="), "_5b6f2953a7162dbe128f5cb0e88fb" . "97d" => base64_decode("cHJvamVjdHMuZmlsZXMuY2FudF9kZWxldGVfcHJva" . "mVjdF9mb2xkZXI="));
use Claromentis\Core\Event\EventSubscriberInterface;
use Claromentis\Core\Localization\Lmsg;
use Claromentis\Documents\Event\DeleteFolderEvent;
use Claromentis\Documents\Event\DocumentEventType;
use Claromentis\Projects\Repository\ProjectRepository;
use Claromentis\Projects\Service\FilesService;
class DocumentsSubscriber implements EventSubscriberInterface
{
    
    
    
    
    protected $files_service;
    
    
    
    
    protected $project_repository;
    
    
    
    
    protected $lmsg;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    public static function getSubscribedEvents()
    {
        return [DocumentEventType::PRE_DELETE_FOLDER => $GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_ec7bca63c7f21ec2855" . "3dc2fc0e176e0"]];
    }
    public function __construct(FilesService $files_service, ProjectRepository $project_repository, Lmsg $lmsg)
    {
        $this->files_service = $files_service;
        $this->project_repository = $project_repository;
        $this->lmsg = $lmsg;
    }
    public function OnPreDelete(DeleteFolderEvent $_e62ca7bbb93b52cafc82da1c2aefe9ec)
    {
        
        
        $_a4b4fe29a876bd36f8024f56a625bf4c = $_e62ca7bbb93b52cafc82da1c2aefe9ec->getSubject();
        $_4eba7123fcddc4f01c504628a68f3142 = $_a4b4fe29a876bd36f8024f56a625bf4c->GetId();
        $_31368430520690b5836ac1e7ca278cd1 = $_a4b4fe29a876bd36f8024f56a625bf4c->GetTitle();
        if ($this->files_service->IsFolderOwned($_4eba7123fcddc4f01c504628a68f3142)) {
            $_e62ca7bbb93b52cafc82da1c2aefe9ec->stopPropagation();
            $project_id = $this->project_repository->GetProjectIdFromFolderId($_4eba7123fcddc4f01c504628a68f3142);
            if ($project_id) {
                $project = $this->project_repository->GetProject($project_id);
                $_b7cf44e509d748c744fc283a50922fb3 = $project->GetProperty($GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_8dabb06efc95df4cff7c4afe9185" . "7b53"]);
                $_e62ca7bbb93b52cafc82da1c2aefe9ec->SetErrorMessage(($this->lmsg)($GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_5b6f2953a7162dbe128f5cb0e" . "88fb97d"], $_31368430520690b5836ac1e7ca278cd1, $_b7cf44e509d748c744fc283a50922fb3));
            } else {
                $_e62ca7bbb93b52cafc82da1c2aefe9ec->SetErrorMessage(($this->lmsg)($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_d638e3756ec5958b0e070cee488d3" . "abf"], $_31368430520690b5836ac1e7ca278cd1));
            }
        }
    }
}