<?php
/**
 * Webkul Software.
 * 
 * PHP version 7.0+
 *
 * @category  Webkul
 * @package   Webkul_MobikulCore
 * @author    Webkul <support@webkul.com>
 * @copyright 2010-2019 Webkul Software Private Limited (https://webkul.com)
 * @license   https://store.webkul.com/license.html ASL Licence
 * @link      https://store.webkul.com/license.html
 */

namespace Webkul\MobikulCore\Controller\Adminhtml;
use Magento\Backend\App\Action\Context;
use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Catalog\Api\CategoryRepositoryInterface;
use Webkul\MobikulCore\Api\Data\NotificationInterfaceFactory;

abstract class Notification extends \Magento\Backend\App\Action
{
    protected $date;
    protected $filter;
    protected $helper;
    protected $jsonHelper;
    protected $entityType;
    protected $productType;
    protected $storeManager;
    protected $attributeSet;
    protected $mediaDirectory;
    protected $entityAttribute;
    protected $productResource;
    protected $categoryResource;
    protected $resultJsonFactory;
    protected $resultPageFactory;
    protected $collectionFactory;
    protected $coreRegistry = null;
    protected $fileUploaderFactory;
    protected $resultForwardFactory;
    protected $notificationRepository;
    protected $notificationDataFactory;
    protected $productRepositoryInterface;
    protected $categoryRepositoryInterface;

    public function __construct(
        Context $context,
        \Webkul\MobikulCore\Helper\Data $helper,
        \Magento\Framework\Filesystem $filesystem,
        \Magento\Framework\Registry $coreRegistry,
        \Magento\Framework\Json\Helper\Data $jsonHelper,
        \Magento\Ui\Component\MassAction\Filter $filter,
        \Magento\Catalog\Model\Product\Type $productType,
        \Magento\Framework\Stdlib\DateTime\DateTime $date,
        \Magento\Eav\Model\Entity\Attribute $entityAttribute,
        NotificationInterfaceFactory $notificationDataFactory,
        ProductRepositoryInterface $productRepositoryInterface,
        CategoryRepositoryInterface $categoryRepositoryInterface,
        \Magento\Store\Model\StoreManagerInterface $storeManager,
        \Magento\Catalog\Model\ResourceModel\Product\Flat $entityType,
        \Magento\Framework\View\Result\PageFactory $resultPageFactory,
        \Magento\Catalog\Model\ResourceModel\Product $productResource,
        \Magento\Catalog\Model\ResourceModel\Category $categoryResource,
        \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory,
        \Magento\MediaStorage\Model\File\UploaderFactory $fileUploaderFactory,
        \Magento\Backend\Model\View\Result\ForwardFactory $resultForwardFactory,
        \Webkul\MobikulCore\Api\NotificationRepositoryInterface $notificationRepository,
        \Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\Collection $attributeSet,
        \Webkul\MobikulCore\Model\ResourceModel\Notification\CollectionFactory $collectionFactory
    ) {
        parent::__construct($context);
        $this->date                        = $date;
        $this->filter                      = $filter;
        $this->helper                      = $helper;
        $this->jsonHelper                  = $jsonHelper;
        $this->entityType                  = $entityType;
        $this->productType                 = $productType;
        $this->coreRegistry                = $coreRegistry;
        $this->storeManager                = $storeManager;
        $this->attributeSet                = $attributeSet;
        $this->entityAttribute             = $entityAttribute;
        $this->productResource             = $productResource;
        $this->categoryResource            = $categoryResource;
        $this->collectionFactory           = $collectionFactory;
        $this->resultJsonFactory           = $resultJsonFactory;
        $this->resultPageFactory           = $resultPageFactory;
        $this->fileUploaderFactory         = $fileUploaderFactory;
        $this->resultForwardFactory        = $resultForwardFactory;
        $this->notificationRepository      = $notificationRepository;
        $this->notificationDataFactory     = $notificationDataFactory;
        $this->productRepositoryInterface  = $productRepositoryInterface;
        $this->categoryRepositoryInterface = $categoryRepositoryInterface;
        $this->mediaDirectory              = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);
    }

    protected function _isAllowed()
    {
        return $this->_authorization->isAllowed("Webkul_MobikulCore::notification");
    }
}
