<?php
namespace Claromentis\People\UseCase;

$GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"] ?: array()) + array("_794d33ac1" . "14ec83bc56" . "3988f7b071" . "9c9" => base64_decode("cGVvcGxlLmV" . "ycm9yLmdyb3" . "VwX25vdF9mb" . "3VuZA=="), "_85745d829a2a36247" . "71cec2390e5f8f7" => base64_decode("WW91IGRvIG5vdCBoYXZlIHBlcm1pc3Npb24gdG8" . "gdmlldyBncm91cCA="));
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["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_794d33ac114ec83bc5639" . "88f7b0719c9"]));
        }
        if (!$this->acl->CanViewGroup($context, $_e9208e4fb555ac989f7519e19c1da810)) {
            throw new PermissionException($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_85745d829a2a3624771cec2390e" . "5f8f7"] . $_e9208e4fb555ac989f7519e19c1da810->id);
        }
        return $_e9208e4fb555ac989f7519e19c1da810;
    }
}