<?php
namespace Claromentis\News\DataTable;

$GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"] = (@$GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"] ?: array()) + array("channe" . "l_id" => base64_decode("Y2hhbm5lbF9pZ" . "A=="), "i" . "d" => base64_decode("aWQ" . "="), "_38f12d8b" . "8c719a8ce" . "0fc2faefc" . "225f35" => base64_decode("YXJy" . "YXlf" . "bWFw"), "_70345e6433902b03261cf15959fc8c6" . "7" => base64_decode("bmV3cy5kYXRhdGFibGUuc3Vic2NyaWJlc" . "nMubmFtZQ=="), "n" . "a" . "m" . "e" => base64_decode("bmFtZQ=" . "="));
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["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["n" . "a" . "m" . "e"], ($this->lmsg)($GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_70345e6433902b0" . "3261cf15959fc8c6" . "7"]), 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["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["channe" . "l_id"]);
        $_a0006f2e6058ce959e86bebdcded2da8 = $this->newsRepository->getSubscribedUsers($_8008f05346c1aac49b6f754d74b6c9cc, $_1f50e30be8c2fefa6881834e71d504a2, $_f11369824f533e8206f9ccc0c9aab3a0, $keywords);
        return $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_38f12d8" . "b8c719a8" . "ce0fc2fa" . "efc225f3" . "5"](function ($row) use($context) {
            return [$GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["na" . "me"] => [$row[$GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["nam" . "e"]], $this->urlGenerator->getUserProfileUrl($row[$GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["i" . "d"]], $context), $this->urlGenerator->getUserPhotoUrl($row[$GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "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["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["channel_" . "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;
    }
}