<?php

namespace DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\Action\Installer;

use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\Infrastructure\Service\Listener\Items\Hookable\Hookable;
use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\Infrastructure\Config\Config;
/**
 * Class PluginInstallerAction, activates when plugin is installed or uninstalled.
 */
class PluginInstallerAction implements Hookable
{
    /**
     * @var Config
     */
    private $config;
    public function __construct(Config $config)
    {
        $this->config = $config;
    }
    public function hooks()
    {
        register_activation_hook($this->config->get_param('plugin.file')->get(), [$this, 'on_activation']);
        register_deactivation_hook($this->config->get_param('plugin.file')->get(), [$this, 'on_deactivation']);
    }
    public function on_activation()
    {
        \error_log('on_activation');
        flush_rewrite_rules();
    }
    public function on_deactivation()
    {
        \error_log('on_deactivation');
    }
}
