<?php

namespace DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\Action\Loader\PostType;

use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\Entity\Export;
use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\Helper\PluginHelper;
use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\Infrastructure\Service\Listener\Items\Conditional\Conditional;
use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\Infrastructure\Service\Listener\Items\Hookable\Hookable;
use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\Infrastructure\Config\Config;
use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\Infrastructure\Request\Request;
/**
 * Class ImportPostTypeLoaderAction, import post type loader.
 */
class ExportPostTypeLoaderAction implements Hookable, Conditional
{
    /**
     * @var Config
     */
    private $config;
    /**
     * @var Request
     */
    private $request;
    /**
     * @var PluginHelper
     */
    private $plugin_helper;
    public function __construct(Config $config, Request $request, PluginHelper $helper)
    {
        $this->config = $config;
        $this->request = $request;
        $this->plugin_helper = $helper;
    }
    public function isActive(): bool
    {
        return $this->plugin_helper->is_plugin_page($this->request->get_param('get.page')->getAsString(), $this->request->get_param('get.action')->getAsString());
    }
    public function hooks()
    {
        add_action('init', [$this, 'register_post_type'], 10);
    }
    /**
     * Register post type for single imported file.
     *
     * @return void
     */
    public function register_post_type()
    {
        $args = ['description' => __('Manage Dropshipping Xml.', 'dropshipping-export-free'), 'public' => \false, 'publicly_queryable' => \false, 'show_ui' => \false, 'show_in_menu' => \false, 'query_var' => \true, 'has_archive' => \false, 'hierarchical' => \false, 'show_in_rest' => \false];
        register_post_type(Export::POST_TYPE_SLUG, $args);
    }
}
