<?php
namespace Claromentis\People\UseCase;

$GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"] ?: array()) + array("_85745d829a2a36" . "24771cec2390e5f" . "8f7" => base64_decode("WW91IGRvIG5vdCBoYXZlIHBlcm1pc3" . "Npb24gdG8gdmlldyBncm91cCA="), "_794d33ac114ec83bc563988f7b" . "0719c9" => base64_decode("cGVvcGxlLmVycm9yLmdyb3VwX25vdF9mb" . "3VuZA=="));
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["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_794d33ac114ec83bc563988f" . "7b0719c9"]));
        }
        if (!$this->acl->CanViewGroup($context, $_e9208e4fb555ac989f7519e19c1da810)) {
            throw new PermissionException($GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_85745d829a2a3624" . "771cec2390e5f8f7"] . $_e9208e4fb555ac989f7519e19c1da810->id);
        }
        return $_e9208e4fb555ac989f7519e19c1da810;
    }
}