<?php
namespace Claromentis\Projects\Subscribers;

$GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"] = (@$GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"] ?: array()) + array("_8dabb06efc95df4cff7c4afe9185" . "7b53" => base64_decode("bmF" . "tZQ" . "=="), "_ec7bca63c7f21ec285" . "53dc2fc0e176e0" => base64_decode("T25QcmVEZWxld" . "GU="), "_5b6f2953a7162dbe128f5cb0e88fb" . "97d" => base64_decode("cHJvamVjdHMuZmlsZXMuY2FudF9kZWxldGVfcHJvamVjdF9mb2xk" . "ZXI="), "_d638e37" . "56ec5958" . "b0e070ce" . "e488d3ab" . "f" => base64_decode("cHJvamVjdHMuZml" . "sZXMuY2FudF9kZW" . "xldGVfcm9vdF9mb" . "2xkZXI="));
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["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_ec7bca63c7f21" . "ec28553dc2fc0e" . "176e0"]];
    }
    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["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_8dabb06efc9" . "5df4cff7c4af" . "e91857b53"]);
                $_e62ca7bbb93b52cafc82da1c2aefe9ec->SetErrorMessage(($this->lmsg)($GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_5b6f2953a7162dbe1" . "28f5cb0e88fb97d"], $_31368430520690b5836ac1e7ca278cd1, $_b7cf44e509d748c744fc283a50922fb3));
            } else {
                $_e62ca7bbb93b52cafc82da1c2aefe9ec->SetErrorMessage(($this->lmsg)($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_d638e3756ec5958b0e070cee488d" . "3abf"], $_31368430520690b5836ac1e7ca278cd1));
            }
        }
    }
}