<?php
namespace Claromentis\Projects\Subscribers;

$GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"] = (@$GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"] ?: array()) + array("_d638e3756ec59" . "58b0e070cee488" . "d3abf" => base64_decode("cHJvamVjdHMuZmlsZXMuY2FudF9kZWxldGVfcm9vdF9mb2x" . "kZXI="), "_5b6f2953a7162dbe12" . "8f5cb0e88fb97d" => base64_decode("cHJvamVjdHMuZmlsZXM" . "uY2FudF9kZWxldGVfcH" . "JvamVjdF9mb2xkZXI="), "_8dabb06efc95df4cff7c4afe91857b" . "53" => base64_decode("bm" . "Ft" . "ZQ" . "=="), "_ec7bca63c7f21ec28553dc2fc0e1" . "76e0" => base64_decode("T25QcmVEZWxldGU" . "="));
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["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_ec7bca63c7f21ec28553dc2" . "fc0e176e0"]];
    }
    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"]["_8dabb06efc" . "95df4cff7c4" . "afe91857b53"]);
                $_e62ca7bbb93b52cafc82da1c2aefe9ec->SetErrorMessage(($this->lmsg)($GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_5b6f2953a7162d" . "be128f5cb0e88fb" . "97d"], $_31368430520690b5836ac1e7ca278cd1, $_b7cf44e509d748c744fc283a50922fb3));
            } else {
                $_e62ca7bbb93b52cafc82da1c2aefe9ec->SetErrorMessage(($this->lmsg)($GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_d638e3756ec59" . "58b0e070cee488" . "d3abf"], $_31368430520690b5836ac1e7ca278cd1));
            }
        }
    }
}