<?php
namespace Claromentis\Search;

$GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"] ?: array()) + array("_60db6481fa1386bc8618599a" . "28d5940c" => base64_decode("Y2V" . "pbA" . "=="));
use Claromentis\Search\Client\ElasticsearchResult;
use ErrorHandler;




class Result extends ErrorHandler
{
    protected $results = array();
    protected $success;
    protected $actual_search_time;
    protected $num_results;
    protected $number_of_pages;
    protected $paging_needed;
    protected $pagination_url_query;
    protected $paging_current_page;
    protected $page_size;
    public function __construct(ElasticsearchResult $_d423dc2c3d8635ebf233373650929e41)
    {
        $this->success = $_d423dc2c3d8635ebf233373650929e41->GetSuccess();
        $this->num_results = $_d423dc2c3d8635ebf233373650929e41->GetNumResults();
        $this->actual_search_time = $_d423dc2c3d8635ebf233373650929e41->GetSearchTime();
        if ($_d423dc2c3d8635ebf233373650929e41->IsError()) {
            $this->PassError(false, $_d423dc2c3d8635ebf233373650929e41);
        } else {
            $this->SetResults($_d423dc2c3d8635ebf233373650929e41->GetResults());
        }
    }
    
    
    
    
    
    
    public function SetSuccess($_c96f552040dea8086bf8bdd70059542f)
    {
        $this->success = (bool) $_c96f552040dea8086bf8bdd70059542f;
        return $this;
    }
    
    
    
    
    
    public function GetSuccess()
    {
        return $this->success;
    }
    
    
    
    
    
    public function GetActualSearchTime()
    {
        return $this->actual_search_time;
    }
    
    
    
    
    
    
    
    
    public function SetActualSearchTime($_c8b38c7133c2e8460c1cca42230ac6c2)
    {
        $this->actual_search_time = $_c8b38c7133c2e8460c1cca42230ac6c2;
        return $this;
    }
    
    
    
    
    
    public function AddResult($result)
    {
        $this->results[] = $result;
    }
    
    
    
    
    
    
    public function SetResults($_b4af1f7aa1ccde1a449e9d8afe15b753)
    {
        $this->results = $_b4af1f7aa1ccde1a449e9d8afe15b753;
    }
    
    
    
    
    
    public function GetAllResults()
    {
        return $this->results;
    }
    
    
    
    
    
    public function GetNumResults()
    {
        return $this->num_results;
    }
    
    
    
    
    
    
    public function SetNumberOfPages($_e7877dccf3e0f7a93d7dc2af8683f3ce)
    {
        $this->number_of_pages = (int) $_e7877dccf3e0f7a93d7dc2af8683f3ce;
        return $this;
    }
    
    
    
    
    
    public function GetNumberOfPages()
    {
        return (int) $this->number_of_pages;
    }
    
    
    
    
    
    
    public function SetPagingNeeded($_c96f552040dea8086bf8bdd70059542f)
    {
        $this->paging_needed = (bool) $_c96f552040dea8086bf8bdd70059542f;
        return $this;
    }
    
    
    
    
    
    public function GetPagingNeeded()
    {
        return (bool) $this->paging_needed;
    }
    public function SetPaginationURLQuery($query)
    {
        $this->pagination_url_query = $query;
        return $this;
    }
    public function GetPaginationURLQuery()
    {
        return $this->pagination_url_query;
    }
    public function SetCurrentPage($page)
    {
        $this->paging_current_page = $page;
        return $this;
    }
    public function GetCurrentPage()
    {
        return $this->paging_current_page;
    }
    public function SetPagesize($page)
    {
        $this->page_size = $page;
        return $this;
    }
    public function GetPagesize()
    {
        return $this->page_size;
    }
    public function InitPagination($_e579d55980ff9509e815eb197510a92f, $_ccd9e402149a4aff4a20de187781aa41, $_30e40f3c8404df316effbfe6d1480b2c)
    {
        $_5723204089589b8f57ebd50f53559ced = false;
        $_c2ac0883273eecb098ebc560de686875 = 1;
        if ($this->GetNumResults() / $_e579d55980ff9509e815eb197510a92f > 1) {
            $_5723204089589b8f57ebd50f53559ced = true;
            $_c2ac0883273eecb098ebc560de686875 = $GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_60db6481fa1386bc861859" . "9a28d5940c"]($this->GetNumResults() / $_e579d55980ff9509e815eb197510a92f);
        }
        
        
        $this->SetPagingNeeded($_5723204089589b8f57ebd50f53559ced);
        $this->SetNumberOfPages($_c2ac0883273eecb098ebc560de686875);
        $this->SetCurrentPage($_ccd9e402149a4aff4a20de187781aa41 / $_e579d55980ff9509e815eb197510a92f);
        $this->SetPagesize($_e579d55980ff9509e815eb197510a92f);
        $this->SetPaginationURLQuery($_30e40f3c8404df316effbfe6d1480b2c);
        return $this;
    }
}