<?php
namespace Claromentis\News\DataTable;

$GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"] ?: array()) + array("_70345e6433902b03261cf" . "15959fc8c67" => base64_decode("bmV3cy5kYXRhdGFibGUuc3V" . "ic2NyaWJlcnMubmFtZQ=="), "i" . "d" => base64_decode("a" . "W" . "Q" . "="), "_38f12d8b8c719a8ce" . "0fc2faefc225f35" => base64_decode("YXJyYX" . "lfbWFw"), "n" . "a" . "m" . "e" => base64_decode("bmFtZQ=" . "="), "channel_i" . "d" => base64_decode("Y2hhb" . "m5lbF" . "9pZA=" . "="));
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["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["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["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["chann" . "el_id"]);
        $_a0006f2e6058ce959e86bebdcded2da8 = $this->newsRepository->getSubscribedUsers($_8008f05346c1aac49b6f754d74b6c9cc, $_1f50e30be8c2fefa6881834e71d504a2, $_f11369824f533e8206f9ccc0c9aab3a0, $keywords);
        return $GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_38f12d8b8c719a8ce0fc2fa" . "efc225f35"](function ($row) use($context) {
            return [$GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["na" . "me"] => [$row[$GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["nam" . "e"]], $this->urlGenerator->getUserProfileUrl($row[$GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["i" . "d"]], $context), $this->urlGenerator->getUserPhotoUrl($row[$GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["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["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["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;
    }
}