<?php
namespace Claromentis\News\DataTable;

$GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"] ?: array()) + array("n" . "a" . "m" . "e" => base64_decode("bmFtZQ" . "=="), "_38f12d8b" . "8c719a8ce" . "0fc2faefc" . "225f35" => base64_decode("YXJyYXlfbW" . "Fw"), "i" . "d" => base64_decode("a" . "W" . "Q" . "="), "chan" . "nel_" . "id" => base64_decode("Y2hhbm5" . "lbF9pZA" . "=="), "_70345e6433902b03261cf15959fc8" . "c67" => base64_decode("bmV3cy5kYXRhdGFibGUuc3Vic" . "2NyaWJlcnMubmFtZQ=="));
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["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["nam" . "e"], ($this->lmsg)($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_70345e6433902b03261cf15959fc" . "8c67"]), 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["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["channel" . "_id"]);
        $_a0006f2e6058ce959e86bebdcded2da8 = $this->newsRepository->getSubscribedUsers($_8008f05346c1aac49b6f754d74b6c9cc, $_1f50e30be8c2fefa6881834e71d504a2, $_f11369824f533e8206f9ccc0c9aab3a0, $keywords);
        return $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_38f12d8" . "b8c719a8" . "ce0fc2fa" . "efc225f3" . "5"](function ($row) use($context) {
            return [$GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["nam" . "e"] => [$row[$GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["n" . "a" . "m" . "e"]], $this->urlGenerator->getUserProfileUrl($row[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["i" . "d"]], $context), $this->urlGenerator->getUserPhotoUrl($row[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["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["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["chan" . "nel_" . "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;
    }
}