<?php
namespace Claromentis\Orgchart\UseCase;

$GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"] = (@$GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"] ?: array()) + array("_2dc3a4b44676089" . "5a9452f5c6f0eb9b" . "1" => base64_decode("b3JnY2hhcnQuZXJyb3Iu" . "bm9fZGVsZXRlX3JpZ2h0" . "cw=="), "_0c5123aa744f69bbc0e" . "8b3ea2f6e847d" => base64_decode("bG" . "1z" . "Zw" . "=="));
use Claromentis\Core\Security\SecurityContext;
use Claromentis\Orgchart\Exception\AccessDeniedException;
use Claromentis\Orgchart\OrgchartAcl;
use Claromentis\Orgchart\OrgchartRepository;




class DeleteOrgchart
{
    protected $org_chart_repo;
    protected $acl;
    public function __construct(OrgchartRepository $_0bb8bac53757cffec6387614650ed2d8, OrgchartAcl $acl)
    {
        $this->orgchart_repo = $_0bb8bac53757cffec6387614650ed2d8;
        $this->acl = $acl;
    }
    public function DeleteOrgchart(SecurityContext $security, $id)
    {
        if (!$this->acl->CanDeleteOrgchart($security, $id)) {
            throw new AccessDeniedException($GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_0c5123aa74" . "4f69bbc0e8b" . "3ea2f6e847d"]($GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_2dc3a4b446760895a9452f5c6f0eb9" . "b1"]));
        }
        $this->orgchart_repo->Delete($id);
        $this->orgchart_repo->DeleteImage($id);
        return true;
    }
}