<?php
namespace Claromentis\People\Filter;

$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"] ?: array()) + array("_f11369824f533e8206f9ccc0c9a" . "ab3a0" => base64_decode("bGltaX" . "Q="), "_1f50e30be8c2fefa6881834e71d504a" . "2" => base64_decode("b2" . "Zm" . "c2" . "V0"), "_680cc2b8220e94c8c32b8bc7c655" . "19b4" => base64_decode("aXNfaW5" . "0"));
use Claromentis\Core\Security\SecurityContext;
use Psr\Http\Message\ServerRequestInterface;







abstract class AbstractPeopleFilter
{
    
    
    public $context;
    const DEFAULT_LIMIT = 20;
    const MAX_LIMIT = 200;
    
    
    protected $limit = self::DEFAULT_LIMIT;
    
    
    protected $offset = 0;
    public function __construct(SecurityContext $context)
    {
        $this->context = $context;
    }
    public function IsPaginationSet()
    {
        return $GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_680cc2b8220e94c8c32b8bc7c6551" . "9b4"]($this->limit) && $GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_680cc2b8220e94c8c32b8" . "bc7c65519b4"]($this->offset);
    }
    
    
    
    
    
    
    
    
    
    
    public function GetPublicDefaults() : array
    {
        return [$GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_f11369824f533e8206f9" . "ccc0c9aab3a0"] => $this->limit, $GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_1f50e30be8c2fefa6881834e" . "71d504a2"] => $this->offset];
    }
    
    
    
    
    
    
    
    
    public function SetPaginationAttributesFromRequest(ServerRequestInterface $request) : void
    {
        $this->SetOffset($request->getAttribute($GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_1f50e30be8c2fef" . "a6881834e71d504a" . "2"], 0));
        $this->SetLimit($request->getAttribute($GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_f11369824f5" . "33e8206f9ccc" . "0c9aab3a0"], self::DEFAULT_LIMIT));
    }
    
    
    
    
    
    
    public function SetLimit(int $_f11369824f533e8206f9ccc0c9aab3a0) : void
    {
        if (!$GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_680cc2b8220e94c8c32" . "b8bc7c65519b4"]($_f11369824f533e8206f9ccc0c9aab3a0) || $_f11369824f533e8206f9ccc0c9aab3a0 <= 0) {
            return;
        }
        if ($_f11369824f533e8206f9ccc0c9aab3a0 > self::MAX_LIMIT) {
            $_f11369824f533e8206f9ccc0c9aab3a0 = self::MAX_LIMIT;
        }
        $this->limit = $_f11369824f533e8206f9ccc0c9aab3a0;
    }
    
    
    
    
    
    
    public function SetOffset(int $_1f50e30be8c2fefa6881834e71d504a2) : void
    {
        if (!$GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_680cc2b8220e94c8c32b8bc7c65519b" . "4"]($_1f50e30be8c2fefa6881834e71d504a2) || $_1f50e30be8c2fefa6881834e71d504a2 < 0) {
            return;
        }
        $this->offset = $_1f50e30be8c2fefa6881834e71d504a2;
    }
    
    
    
    
    public function Limit() : int
    {
        return $this->limit;
    }
    
    
    
    
    public function Offset() : int
    {
        return $this->offset;
    }
}