<?php
namespace Claromentis\People\UseCase;

$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"] ?: array()) + array("_85745d82" . "9a2a36247" . "71cec2390" . "e5f8f7" => base64_decode("WW91IGRvIG5vdCBoYXZlIHBlcm1pc3Npb24gdG8gdmlldy" . "Bncm91cCA="), "_794d33ac11" . "4ec83bc5639" . "88f7b0719c9" => base64_decode("cGVvcGxlLmVycm9yL" . "mdyb3VwX25vdF9mb3" . "VuZA=="));
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["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_794d33ac114ec83bc563988" . "f7b0719c9"]));
        }
        if (!$this->acl->CanViewGroup($context, $_e9208e4fb555ac989f7519e19c1da810)) {
            throw new PermissionException($GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_85745d829a2a3624771cec2390e5f8f" . "7"] . $_e9208e4fb555ac989f7519e19c1da810->id);
        }
        return $_e9208e4fb555ac989f7519e19c1da810;
    }
}