<?php
namespace Claromentis\People\UseCase;

$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"] = (@$GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"] ?: array()) + array("_206592e" . "8fa0160b" . "d42ecad1" . "48e6e13e" . "7" => base64_decode("WW91IGRvIG5vdCBoYXZlIHBlcm1pc3Npb24gdG" . "8gdmlldyB0aGlzIHVzZXI="), "_1307d6161" . "7a82e798c5" . "3fada52dc0" . "114" => base64_decode("VXNlciBub3QgZm91bmQ" . "="));
use Claromentis\Core\Security\Exception\AccessDeniedException;
use Claromentis\Core\Security\SecurityContext;
use Claromentis\People\Entity\User;
use Claromentis\People\Exception\NotFoundException;
use Claromentis\People\Filter\UserFilter;
use Claromentis\People\PeopleAcl;
use Claromentis\People\Repository\UserRepository;




class GetUser
{
    
    
    
    
    protected $acl;
    
    
    
    
    protected $repo;
    public function __construct(PeopleAcl $acl, UserRepository $repo)
    {
        $this->acl = $acl;
        $this->repo = $repo;
    }
    
    
    
    
    
    
    
    
    
    public function Get(SecurityContext $context, int $user_id, ?UserFilter $_03e9164d0a343b742df4793268b80767 = null)
    {
        if (!$_03e9164d0a343b742df4793268b80767) {
            $_03e9164d0a343b742df4793268b80767 = new UserFilter($context);
        }
        $_03e9164d0a343b742df4793268b80767->SetPeopleAcl($this->acl);
        
        
        
        
        $_24e0e36600d6af77406a44bb618a6253 = $this->repo->findOneWithFilter($user_id, $_03e9164d0a343b742df4793268b80767);
        if (empty($_24e0e36600d6af77406a44bb618a6253)) {
            throw new NotFoundException($GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_1307d616" . "17a82e798" . "c53fada52" . "dc0114"]);
        }
        if (!$this->acl->CanViewUser($context, $user_id) && !$this->acl->CanViewUserAsAdmin($context, $user_id)) {
            throw new AccessDeniedException($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_206592e8fa0160bd42ecad" . "148e6e13e7"]);
        }
        return $_24e0e36600d6af77406a44bb618a6253;
    }
}