<?php
namespace Claromentis\News\DataTable;

$GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"] = (@$GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"] ?: array()) + array("n" . "a" . "m" . "e" => base64_decode("bmFtZ" . "Q=="), "i" . "d" => base64_decode("aWQ" . "="), "channel_" . "id" => base64_decode("Y2hh" . "bm5l" . "bF9p" . "ZA=="), "_70345e6433902b03" . "261cf15959fc8c67" => base64_decode("bmV3cy5kYXRhdGFibGUuc3Vic2Ny" . "aWJlcnMubmFtZQ=="), "_38f12d8b8c719" . "a8ce0fc2faefc2" . "25f35" => base64_decode("YXJ" . "yYX" . "lfb" . "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["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["na" . "me"], ($this->lmsg)($GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_70345e64" . "33902b032" . "61cf15959" . "fc8c67"]), 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["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["channel_i" . "d"]);
        $_a0006f2e6058ce959e86bebdcded2da8 = $this->newsRepository->getSubscribedUsers($_8008f05346c1aac49b6f754d74b6c9cc, $_1f50e30be8c2fefa6881834e71d504a2, $_f11369824f533e8206f9ccc0c9aab3a0, $keywords);
        return $GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_38f12d8b8c719a8ce0fc2faefc22" . "5f35"](function ($row) use($context) {
            return [$GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["na" . "me"] => [$row[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["na" . "me"]], $this->urlGenerator->getUserProfileUrl($row[$GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["i" . "d"]], $context), $this->urlGenerator->getUserPhotoUrl($row[$GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["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["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["channel_i" . "d"]);
        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;
    }
}