<?php
namespace Claromentis\People\UseCase;

$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"] = (@$GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"] ?: array()) + array("_85745d829a2a3624771c" . "ec2390e5f8f7" => base64_decode("WW91IGRvIG5vdCBoYXZlIHBlcm1pc3Npb24gdG8gdmlldyBnc" . "m91cCA="), "_794d33ac114ec83bc563988f7b071" . "9c9" => base64_decode("cGVvcGxlLmVy" . "cm9yLmdyb3Vw" . "X25vdF9mb3Vu" . "ZA=="));
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["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_794d33ac114ec83bc563988f7b0719" . "c9"]));
        }
        if (!$this->acl->CanViewGroup($context, $_e9208e4fb555ac989f7519e19c1da810)) {
            throw new PermissionException($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_85745d829a2a362" . "4771cec2390e5f8f" . "7"] . $_e9208e4fb555ac989f7519e19c1da810->id);
        }
        return $_e9208e4fb555ac989f7519e19c1da810;
    }
}