<?php
namespace Claromentis\People\UseCase;

$GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"] ?: array()) + array("_85745d829a2a362" . "4771cec2390e5f8f" . "7" => base64_decode("WW91IGRvIG5vdCBoYXZlIHBlcm1pc3N" . "pb24gdG8gdmlldyBncm91cCA="), "_794d33ac114ec83bc5" . "63988f7b0719c9" => base64_decode("cGVvcGxlLmVycm9yLmdyb3VwX2" . "5vdF9mb3VuZA=="));
use Claromentis\Core\Localization\Lmsg;
use Claromentis\Core\ORM\Exceptions\EntityNotFoundException;
use Claromentis\Core\Security\SecurityContext;
use Claromentis\People\Entity\Group;
use Claromentis\People\Exception\NotFoundException;
use Claromentis\People\Exception\PermissionException;
use Claromentis\People\Filter\GroupFilter;
use Claromentis\People\PeopleAcl;
use Claromentis\People\Repository\GroupRepository;
class GetGroup
{
    
    
    
    
    private $acl;
    
    
    
    
    private $repo;
    
    
    
    
    private $lmsg;
    public function __construct(PeopleAcl $acl, GroupRepository $repo, Lmsg $lmsg)
    {
        $this->acl = $acl;
        $this->repo = $repo;
        $this->lmsg = $lmsg;
    }
    
    
    
    
    
    
    
    
    
    
    
    public function GetGroup(SecurityContext $context, int $group_id, ?GroupFilter $_03e9164d0a343b742df4793268b80767 = null) : Group
    {
        if (!$_03e9164d0a343b742df4793268b80767) {
            $_03e9164d0a343b742df4793268b80767 = new GroupFilter($context);
        }
        
        
        
        
        $_e9208e4fb555ac989f7519e19c1da810 = $this->repo->findOneWithFilter($group_id, $_03e9164d0a343b742df4793268b80767);
        if (!$_e9208e4fb555ac989f7519e19c1da810) {
            throw new NotFoundException(($this->lmsg)($GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_794d33ac114ec83bc563988" . "f7b0719c9"]));
        }
        if (!$this->acl->CanViewGroup($context, $_e9208e4fb555ac989f7519e19c1da810)) {
            throw new PermissionException($GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_85745d829a2a3624771cec2390e5f8" . "f7"] . $_e9208e4fb555ac989f7519e19c1da810->id);
        }
        return $_e9208e4fb555ac989f7519e19c1da810;
    }
}