<?php
namespace Claromentis\Core\DataTable\Controller;

$GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"] ?: array()) + array("_e0bd284b1527841b" . "c9c635873b56303b" => base64_decode("Zmls" . "dGVy" . "cw=="), "_e57541d732d72dc01c88f3809f7" . "713c9" => base64_decode("cmVzdC5m" . "b3JtYXR0" . "ZXI="), "_9785edd5ebc204f41" . "5762081467d2ef5" => base64_decode("ZHJ" . "hdw" . "=="), "_7681c2a" . "2b7e1bdf" . "69c23c6c" . "d64114ad" . "3" => base64_decode("anNvbl9" . "kZWNvZG" . "U="), "_ef3ede8a88b911b40f6" . "68ee2fc81ab9b" => base64_decode("U2VydmljZSBub3QgZm91bm" . "Q="));
use Claromentis\Core\Csv\Csv;
use Claromentis\Core\DataTable;
use Claromentis\Core\Application;
use Claromentis\Core\Http\JsonPrettyResponse;
use Psr\Http\Message\ServerRequestInterface;
use RestExNotFound;






class RestController
{
    
    
    
    
    
    
    
    
    
    public function GetDTSource(Application $app, ServerRequestInterface $request, $service_name)
    {
        
        
        
        
        if (!isset($app[$service_name]) || !$app[$service_name] instanceof DataTable\Contract\DataSource) {
            throw new RestExNotFound($GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_ef3ede8a88b" . "911b40f668ee" . "2fc81ab9b"]);
        }
        $formatter = $app[$GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_e57541d732d7" . "2dc01c88f3809" . "f7713c9"]];
        $_4d348406673ac4fa7aebc6394e363899 = $app[$service_name];
        $_a53adacafa21661496d4fce8a01a6375 = $formatter->GetJson($request);
        $_4c4d12d3e4f6cac68e3eecffe9887915 = DataTable\TableParams::Create($_a53adacafa21661496d4fce8a01a6375);
        $_e0bd284b1527841bc9c635873b56303b = new DataTable\ColumnFilterCollection($_4d348406673ac4fa7aebc6394e363899->Filters(), $_a53adacafa21661496d4fce8a01a6375[$GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_e0bd284b1527841bc9c635873b56303" . "b"]]);
        $_d48b44db6e041005c0bc32872d95cd10 = new DataTable\TableView($_4d348406673ac4fa7aebc6394e363899, $_4c4d12d3e4f6cac68e3eecffe9887915, $_e0bd284b1527841bc9c635873b56303b);
        $_d48b44db6e041005c0bc32872d95cd10->SetDtDraw(isset($_a53adacafa21661496d4fce8a01a6375[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_9785edd5ebc204f415762081" . "467d2ef5"]]) ? $_a53adacafa21661496d4fce8a01a6375[$GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_9785edd" . "5ebc204f" . "41576208" . "1467d2ef" . "5"]] : 1);
        return new JsonPrettyResponse($_d48b44db6e041005c0bc32872d95cd10->Draw($app->security));
    }
    
    
    
    
    
    
    
    
    
    public function GetDTDownload(Application $app, ServerRequestInterface $request, $service_name)
    {
        
        
        
        
        if (!isset($app[$service_name]) || !$app[$service_name] instanceof DataTable\Contract\DataSource) {
            throw new RestExNotFound($GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_ef3ede8a88b9" . "11b40f668ee2f" . "c81ab9b"]);
        }
        $_4d348406673ac4fa7aebc6394e363899 = $app[$service_name];
        $_14d7763bd68d2a696994ae5aec7dad69 = new Csv();
        $_a53adacafa21661496d4fce8a01a6375 = $request->getParsedBody();
        foreach ($_a53adacafa21661496d4fce8a01a6375 as &$_24ca62b4d01cc6d515dfd0bea4c9d59a) {
            $_24ca62b4d01cc6d515dfd0bea4c9d59a = $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_7681c2a2b7e1bdf69c2" . "3c6cd64114ad3"]($_24ca62b4d01cc6d515dfd0bea4c9d59a, true);
        }
        $_4c4d12d3e4f6cac68e3eecffe9887915 = DataTable\TableParams::Create($_a53adacafa21661496d4fce8a01a6375);
        $_e0bd284b1527841bc9c635873b56303b = new DataTable\ColumnFilterCollection($_4d348406673ac4fa7aebc6394e363899->Filters(), $_a53adacafa21661496d4fce8a01a6375[$GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_e0bd284b1527841bc9c635873b5" . "6303b"]]);
        $_d48b44db6e041005c0bc32872d95cd10 = new DataTable\TableView($_4d348406673ac4fa7aebc6394e363899, $_4c4d12d3e4f6cac68e3eecffe9887915, $_e0bd284b1527841bc9c635873b56303b, $_14d7763bd68d2a696994ae5aec7dad69);
        return $_d48b44db6e041005c0bc32872d95cd10->Download($app->security);
    }
}