<?php
namespace Claromentis\People\UseCase;

$GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"] = (@$GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"] ?: array()) + array("_6c8c5387f046854f266" . "c918d1562fe23" => base64_decode("cGVvcGxlLmVycm9yLm" . "V4dHJhbmV0X3ByaW1h" . "cnlfZm9yYmlkZGVu"), "_f77bfca3490ee96b0c88c8733efe7c" . "5c" => base64_decode("RXh0cmFuZX" . "Qgd2l0aCBJ" . "RCA="), "_fa96cdf58bff3b0695fb2bc0" . "803d7b12" => base64_decode("IGRvZXMgb" . "m90IGV4aX" . "N0"));
use Claromentis\Core\Localization\Lmsg;
use Claromentis\Core\Security\SecurityContext;
use Claromentis\People\Entity\Extranet;
use Claromentis\People\Exception\PermissionException;
use Claromentis\People\Exception\ValidationException;
use Claromentis\People\PeopleAcl;
use Claromentis\People\Repository\ExtranetRepository;
class SetPrimaryExtranet
{
    
    
    
    
    protected $acl;
    
    
    
    
    protected $lmsg;
    
    
    
    
    protected $repository;
    public function __construct(PeopleAcl $acl, Lmsg $lmsg, ExtranetRepository $_8652ba33e6ffeba02459fa9cbb320851)
    {
        $this->acl = $acl;
        $this->lmsg = $lmsg;
        $this->repository = $_8652ba33e6ffeba02459fa9cbb320851;
    }
    
    
    
    
    
    
    
    
    public function SetPrimaryExtranet(SecurityContext $context, int $id)
    {
        if (!$this->acl->IsPeopleAdmin($context)) {
            throw new PermissionException(($this->lmsg)($GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_6c8c5387f046854f266c918d1562fe2" . "3"]));
        }
        
        
        $_9a2ef4ae6a5745ffe5fac33c88a222fa = $this->repository->find($id);
        if (!$_9a2ef4ae6a5745ffe5fac33c88a222fa) {
            throw new ValidationException($GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_f77bfca3490e" . "e96b0c88c8733" . "efe7c5c"] . $id . $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_fa96cdf58bff3b0695fb2bc0803" . "d7b12"]);
        }
        $this->repository->setPrimaryExtranet($_9a2ef4ae6a5745ffe5fac33c88a222fa);
    }
}