<?php
namespace Claromentis\Pages\Facade;

$GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"] = (@$GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"] ?: array()) + array();
use Claromentis\Core\Acl\Acl;
use Claromentis\Pages\PagesAcl;
use Claromentis\Pages\Perm;
use Claromentis\Pages\Repository\PagesRepository;
use Claromentis\Pages\Repository\TileProvider;
use Claromentis\Pages\Repository\UrlRepository;
use Claromentis\Pages\Search\Indexing\PageIndexing;
use Claromentis\Search\Indexing\IndexingQueue;




class DeletePageUrl
{
    protected $url_repository;
    protected $pages_repository;
    protected $tile_repository;
    protected $pages_acl;
    public function __construct(UrlRepository $_0ffc8e5433da0b1c27f79e871fb130bc, PagesRepository $_15c0717e770727776c3990dfe554a36b, TileProvider $_d5785f49d6f10969df73095674a79a12, PagesAcl $pages_acl)
    {
        $this->url_repository = $_0ffc8e5433da0b1c27f79e871fb130bc;
        $this->pages_repository = $_15c0717e770727776c3990dfe554a36b;
        $this->tile_repository = $_d5785f49d6f10969df73095674a79a12;
        $this->pages_acl = $pages_acl;
    }
    
    
    
    
    
    
    public function DeleteOneById($_ac4dbc10ecf438074b2cfc89879aacb5)
    {
        $page_url = $this->url_repository->GetById($_ac4dbc10ecf438074b2cfc89879aacb5);
        $_3f05c7e033d5fa5883b27e9248e3ab53 = $this->pages_repository->GetAllVersions($_ac4dbc10ecf438074b2cfc89879aacb5);
        foreach ($_3f05c7e033d5fa5883b27e9248e3ab53 as $_221da17e3055fae8d3ff516b832a5f3b) {
            $this->tile_repository->DeletePageTiles($_221da17e3055fae8d3ff516b832a5f3b->id, true);
            $this->pages_repository->Delete($_221da17e3055fae8d3ff516b832a5f3b);
            $this->pages_acl->SetPageAcl($_221da17e3055fae8d3ff516b832a5f3b->id, new Acl(Perm::CLASS_PAGE));
        }
        
        
        $this->url_repository->Delete($page_url);
        IndexingQueue::DeleteIndex(PageIndexing::TYPE_NAME, $_ac4dbc10ecf438074b2cfc89879aacb5);
    }
}