<?php
namespace Claromentis\Pages\UseCase;

$GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"] = (@$GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"] ?: array()) + array("_795cf2d94dc58d02d01c2" . "3e25295b2ad" => base64_decode("d2lkd" . "Gg="), "_11cad0367c939d76c4f8" . "77581c151a10" => base64_decode("e" . "Q" . "=" . "="), "_4ed3ada46a23e917ec1dd41d39de" . "09aa" => base64_decode("cGFnZXMubGF5" . "b3V0Lm5vX3Bl" . "cm1pc3Npb24="), "_f9696953938" . "d5eb0c93b156" . "2b60ba3a6" => base64_decode("eA" . "=="), "_0c5123aa744f69b" . "bc0e8b3ea2f6e847" . "d" => base64_decode("bG1zZ" . "w=="), "_3fe79c1c3dbe98dac252d4" . "b18cccf315" => base64_decode("dGlsZV9pZA" . "=="), "_7878552e2416819" . "999092641d19320a" . "e" => base64_decode("aGVpZ2" . "h0"));
use Claromentis\Core\Security\SecurityContext;
use Claromentis\Pages\Exception\AccessDeniedException;
use Claromentis\Pages\Lock\LockService;
use Claromentis\Pages\PagesAcl;
use Claromentis\Pages\Repository\PagesRepository;
use Claromentis\Pages\Repository\TileProvider;




class SaveGeometry
{
    protected $pages_repo;
    protected $tile_provider;
    protected $acl;
    protected $locks;
    public function __construct(PagesRepository $pages_repo, TileProvider $tile_provider, PagesAcl $acl, LockService $_9cd4b2152729fd679e63852ebc623594)
    {
        $this->pages_repo = $pages_repo;
        $this->tile_provider = $tile_provider;
        $this->acl = $acl;
        $this->locks = $_9cd4b2152729fd679e63852ebc623594;
    }
    
    
    
    
    
    
    
    
    
    
    
    
    public function Save(SecurityContext $context, $_720c0c64bd5b02debfb65448083be0bf, $_490a24fd65ef2b3ccfc5941892ef496b)
    {
        $_221da17e3055fae8d3ff516b832a5f3b = $this->pages_repo->GetById($_720c0c64bd5b02debfb65448083be0bf);
        
        
        if (!$this->acl->CanEditPage($context, $_221da17e3055fae8d3ff516b832a5f3b)) {
            throw new AccessDeniedException($GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_0c5123aa744f69bbc0e8b3e" . "a2f6e847d"]($GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_4ed3ada46a23e917ec1dd" . "41d39de09aa"]));
        }
        $this->locks->Extend($_221da17e3055fae8d3ff516b832a5f3b->url_id, $context->GetUserId());
        $_019b08c82680fcd8e809591bdfa5c097 = [];
        foreach ($_490a24fd65ef2b3ccfc5941892ef496b as $tile) {
            $_019b08c82680fcd8e809591bdfa5c097[] = $tile[$GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_3fe79c1c3dbe98dac2" . "52d4b18cccf315"]];
        }
        $this->tile_provider->SoftDeleteMissing($_720c0c64bd5b02debfb65448083be0bf, $_019b08c82680fcd8e809591bdfa5c097);
        foreach ($_490a24fd65ef2b3ccfc5941892ef496b as $tile) {
            $this->tile_provider->SaveGeometry($_720c0c64bd5b02debfb65448083be0bf, $tile[$GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_3fe79c1c3dbe98dac25" . "2d4b18cccf315"]], $tile[$GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_f9696953938d5eb" . "0c93b1562b60ba3a" . "6"]], $tile[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_11cad0367c939d7" . "6c4f877581c151a1" . "0"]], $tile[$GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_795cf2d9" . "4dc58d02d" . "01c23e252" . "95b2ad"]], $tile[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_7878552e24168199990" . "92641d19320ae"]]);
        }
    }
}