<?php
namespace Claromentis\People\UseCase;

$GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"] ?: array()) + array("_a1caefb4edf6ba2bf50" . "be01b6f784e1c" => base64_decode("KSBoYXMgaGFkIHRo" . "ZWlyIG1hbmFnZXIg" . "c2V0IHRvIA=="), "_0284d38f97f9e8b9c7b03bb8928a" . "fae1" => base64_decode("K" . "Q" . "=" . "="), "_76d14612538e52c5e63" . "29ce4fa353f1a" => base64_decode("WW91IGRvIG5vdCBoYXZl" . "IHBlcm1pc3Npb24gdG8g" . "ZWRpdCB0aGlzIHVzZXI="), "_f149cf29770e82095" . "e992315e2ab26e2" => base64_decode("KA=" . "="), "_28fd57f750dbb5ffb3ffad3a" . "888358a9" => base64_decode("ZGVzY3" . "JpcHRp" . "b24="));
use Claromentis\Core\Event\EventDispatcher;
use Claromentis\Core\Event\GenericEvent;
use Claromentis\Core\Security\Exception\AccessDeniedException;
use Claromentis\Core\Security\SecurityContext;
use Claromentis\People\Entity\User;
use Claromentis\People\Event\PeopleEventType;
use Claromentis\People\Exception\ValidationException;
use Claromentis\People\PeopleAcl;
use Claromentis\People\Repository\UserRepository;
use Claromentis\People\UsersHierarchyService;
use Claromentis\People\Validator\ValidateSetManager;
class SetManager
{
    
    
    
    
    protected $acl;
    
    
    
    
    protected $validator;
    
    
    
    
    protected $hierarchy_service;
    
    
    
    
    protected $event_dispatcher;
    
    
    
    
    protected $user_repository;
    public function __construct(PeopleAcl $acl, ValidateSetManager $_24c8d051c033d19c2c97cdc3d7098b1b, UsersHierarchyService $_59dfd60487c7d5e6828b1f906741c1a4, EventDispatcher $event_dispatcher, UserRepository $_eeeeb0d673b7b0fd0bdca58b5541c3e0)
    {
        $this->acl = $acl;
        $this->validator = $_24c8d051c033d19c2c97cdc3d7098b1b;
        $this->hierarchy_service = $_59dfd60487c7d5e6828b1f906741c1a4;
        $this->event_dispatcher = $event_dispatcher;
        $this->user_repository = $_eeeeb0d673b7b0fd0bdca58b5541c3e0;
    }
    
    
    
    
    
    
    
    
    public function SetManager(SecurityContext $context, int $user_id, int $_b324f64f5346fe6cd20483e208d94430)
    {
        if (!$this->acl->CanUpdateUser($context, $user_id)) {
            throw new AccessDeniedException($GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_76d1461" . "2538e52c" . "5e6329ce" . "4fa353f1" . "a"]);
        }
        $this->validator->Validate($user_id, $_b324f64f5346fe6cd20483e208d94430);
        $this->hierarchy_service->SetManager($user_id, $_b324f64f5346fe6cd20483e208d94430);
        
        
        $_24e0e36600d6af77406a44bb618a6253 = $this->user_repository->find($user_id);
        
        
        $_ef41738096964d8cc071f2538d6b9969 = $this->user_repository->find($_b324f64f5346fe6cd20483e208d94430);
        $_28fd57f750dbb5ffb3ffad3a888358a9 = $_24e0e36600d6af77406a44bb618a6253->fullname . $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_f149cf29770e82095e992315" . "e2ab26e2"] . $_24e0e36600d6af77406a44bb618a6253->id . $GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_a1caefb4edf6ba2bf50be01b6f784e1" . "c"] . $_ef41738096964d8cc071f2538d6b9969->fullname . $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_f149cf297" . "70e82095e9" . "92315e2ab2" . "6e2"] . $_ef41738096964d8cc071f2538d6b9969->id . $GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_0284d38f97f9e8b9c7b03bb8" . "928afae1"];
        
        
        
        
        $event = new GenericEvent($_24e0e36600d6af77406a44bb618a6253, [$GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_28fd57f750dbb5ffb3ff" . "ad3a888358a9"] => $_28fd57f750dbb5ffb3ffad3a888358a9]);
        $this->event_dispatcher->dispatch(PeopleEventType::SET_USER_MANAGER, $event);
        return $_ef41738096964d8cc071f2538d6b9969;
    }
}