<?php

namespace DropshippingXmlFreeVendor\WPDesk\Library\DropshippingXmlCore\Action\Loader\Plugin;

use DropshippingXmlFreeVendor\WPDesk\Library\DropshippingXmlCore\Helper\PluginHelper;
use DropshippingXmlFreeVendor\WPDesk\Library\DropshippingXmlCore\Infrastructure\Service\Listener\Items\Hookable\Hookable;
use DropshippingXmlFreeVendor\WPDesk\Library\DropshippingXmlCore\Infrastructure\Config\Config;
use DropshippingXmlFreeVendor\WPDesk\Library\DropshippingXmlCore\Infrastructure\Request\Request;
use DropshippingXmlFreeVendor\WPDesk\Library\DropshippingXmlCore\Action\View\ImportManagerViewAction;
use DropshippingXmlFreeVendor\WPDesk\Library\DropshippingXmlCore\Action\View\MarketingViewAction;
/**
 * Class PluginLinksLoaderAction, plugin links loader.
 */
class PluginLinksLoaderAction implements Hookable
{
    /**
     * @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 hooks()
    {
        add_filter('plugin_action_links_' . \plugin_basename($this->config->get_param('plugin.file')->get()), [$this, 'links_filter']);
    }
    public function links_filter(array $links): array
    {
        $plugin_links = ['<a style="color:#007050; font-weight:bold" href="' . $this->plugin_helper->generate_url_by_view(MarketingViewAction::class) . '">' . __('Start here', 'dropshipping-xml-for-woocommerce') . '</a>', '<a href="' . $this->plugin_helper->generate_url_by_view(ImportManagerViewAction::class) . '">' . __('Settings', 'dropshipping-xml-for-woocommerce') . '</a>', '<a href="' . __('https://www.wpdesk.net/sk/woocommerce-dropshipping-xml-docs/', 'dropshipping-xml-for-woocommerce') . '">' . __('Docs', 'dropshipping-xml-for-woocommerce') . '</a>'];
        return array_merge($plugin_links, $links);
    }
}
