<?php
namespace Claromentis\News\DataTable;

$GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"] = (@$GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"] ?: array()) + array("na" . "me" => base64_decode("bmF" . "tZQ" . "=="), "channel_i" . "d" => base64_decode("Y2hhbm5lbF9pZA=" . "="), "_70345e6433902b03261cf159" . "59fc8c67" => base64_decode("bmV3cy5kYXRhdGFibGUuc3Vic2NyaWJlcnMubmFtZQ" . "=="), "i" . "d" => base64_decode("aWQ" . "="), "_38f12d8b8c719" . "a8ce0fc2faefc2" . "25f35" => base64_decode("YXJyYXlfb" . "WFw"));
use Claromentis\Core\Admin\AdminPanel;
use Claromentis\Core\DataTable\Contract\DataSource;
use Claromentis\Core\DataTable\Contract\Parameters;
use Claromentis\Core\DataTable\Contract\TableFilter;
use Claromentis\Core\DataTable\Decorator\Avatar;
use Claromentis\Core\DataTable\Shared\ColumnHelper;
use Claromentis\Core\Localization\Lmsg;
use Claromentis\Core\Security\SecurityContext;
use Claromentis\News\Repository\ChannelRepository;
use Claromentis\People\UrlGenerator;
class ChannelSubscribersDataSource implements DataSource
{
    use ColumnHelper;
    
    
    
    
    
    
    protected Lmsg $lmsg;
    
    
    
    
    
    
    protected ChannelRepository $newsRepository;
    
    
    
    
    
    
    
    
    protected UrlGenerator $urlGenerator;
    
    
    
    
    
    
    protected AdminPanel $adminPanel;
    
    
    
    
    
    
    
    
    
    public function __construct(Lmsg $lmsg, ChannelRepository $_edd20367c933675edb8c5b95969143b4, UrlGenerator $_34a0363510ed2e35bf8988d3e2a3b529, AdminPanel $_3dfaa2b9f156ba68eecd8e8f3be689a9)
    {
        $this->lmsg = $lmsg;
        $this->newsRepository = $_edd20367c933675edb8c5b95969143b4;
        $this->urlGenerator = $_34a0363510ed2e35bf8988d3e2a3b529;
        $this->adminPanel = $_3dfaa2b9f156ba68eecd8e8f3be689a9;
    }
    public function Columns(SecurityContext $context, Parameters $_4c4d12d3e4f6cac68e3eecffe9887915 = null)
    {
        return $this->CreateWithColumns([[$GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["nam" . "e"], ($this->lmsg)($GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_70345e6433902b03" . "261cf15959fc8c67"]), new Avatar()]]);
    }
    public function Data(SecurityContext $context, Parameters $_4c4d12d3e4f6cac68e3eecffe9887915, TableFilter $_03e9164d0a343b742df4793268b80767)
    {
        if (!$this->CheckPermissions($context)) {
            return [];
        }
        $_1f50e30be8c2fefa6881834e71d504a2 = $_4c4d12d3e4f6cac68e3eecffe9887915->GetOffset();
        $_f11369824f533e8206f9ccc0c9aab3a0 = $_4c4d12d3e4f6cac68e3eecffe9887915->GetLimit();
        $keywords = $_4c4d12d3e4f6cac68e3eecffe9887915->GetKeywords();
        $_8008f05346c1aac49b6f754d74b6c9cc = (int) $_4c4d12d3e4f6cac68e3eecffe9887915->GetValue($GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["channel" . "_id"]);
        $_a0006f2e6058ce959e86bebdcded2da8 = $this->newsRepository->getSubscribedUsers($_8008f05346c1aac49b6f754d74b6c9cc, $_1f50e30be8c2fefa6881834e71d504a2, $_f11369824f533e8206f9ccc0c9aab3a0, $keywords);
        return $GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_38f12d8b8c71" . "9a8ce0fc2faef" . "c225f35"](function ($row) use($context) {
            return [$GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["nam" . "e"] => [$row[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["n" . "a" . "m" . "e"]], $this->urlGenerator->getUserProfileUrl($row[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["i" . "d"]], $context), $this->urlGenerator->getUserPhotoUrl($row[$GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["i" . "d"]], $context)]];
        }, $_a0006f2e6058ce959e86bebdcded2da8);
    }
    public function Count(SecurityContext $context, Parameters $_4c4d12d3e4f6cac68e3eecffe9887915, TableFilter $_e0bd284b1527841bc9c635873b56303b)
    {
        if (!$this->CheckPermissions($context)) {
            return [];
        }
        $keywords = $_4c4d12d3e4f6cac68e3eecffe9887915->GetKeywords();
        $_8008f05346c1aac49b6f754d74b6c9cc = (int) $_4c4d12d3e4f6cac68e3eecffe9887915->GetValue($GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["chann" . "el_id"]);
        return $this->newsRepository->getTotalSubscribedUsers($_8008f05346c1aac49b6f754d74b6c9cc, $keywords);
    }
    public function Filters()
    {
        
        
        return [];
    }
    
    
    
    
    
    
    
    protected function CheckPermissions(SecurityContext $context) : bool
    {
        if ($this->adminPanel->IsAccessible($context)) {
            return true;
        }
        return false;
    }
}