<?php

namespace Linksy\SearchAndReplace\Plugli\Standard\Admin;

use Linksy\SearchAndReplace\Plugli\Standard\Admin\Partials\Partials;
use Linksy\SearchAndReplace\Plugli\Standard\Common\Traits\Hooker;
use Linksy\SearchAndReplace\Plugli\Standard\Helpers\Utils;
/**
 * The admin-specific functionality of the plugin.
 *
 * Defines the plugin name, version, and two examples hooks for how to
 * enqueue the admin-specific stylesheet and JavaScript.
 *
 * @since      1.0.0
 * @author    Plugli Team
 */
abstract class Admin
{
    use Hooker;
    /**
     * The ID of this plugin.
     *
     * @since    1.0.0
     * @access   protected
     * @var      string    $plugin_name    The ID of this plugin.
     */
    protected $plugin_name;
    /**
     * The version of this plugin.
     *
     * @since    1.0.0
     * @access   protected
     * @var      string    $version    The current version of this plugin.
     */
    protected $version;
    /**
     * The text domain of this plugin.
     *
     * @since    1.0.0
     * @access   protected
     * @var      string    $plugin_text_domain    The text domain of this plugin.
     */
    protected $plugin_text_domain;
    /**
     * Base files directory of this plugin.
     *
     * @since    1.0.0
     * @access   protected
     * @var      string    $plugin_base_dir    Base files directory of this plugin.
     */
    protected $plugin_base_dir;
    /**
     * Base files path of this plugin.
     *
     * @since    1.0.0
     * @access   protected
     * @var      string    $plugin_base_path    Base files path of this plugin.
     */
    protected $plugin_base_path;
    /**
     * Pages
     *
     * @since 1.1.0
     * @access protected
     * @var array
     */
    protected $pages = [];
    /**
     * Admin globals
     *
     * @since 1.1.0
     * @access protected
     * @var array
     */
    protected $admin_globals = [];
    /**
     * Initialize the class and set its properties.
     *
     * @since       1.0.0
     * @param       string $plugin_name        The name of this plugin.
     * @param       string $version            The version of this plugin.
     * @param       string $plugin_text_domain The text domain of this plugin.
     */
    public function __construct($plugin_name, $version, $plugin_text_domain)
    {
        $this->plugin_name = $plugin_name;
        $this->version = $version;
        $this->plugin_text_domain = $plugin_text_domain;
        $this->plugin_base_dir = plugin_dir_url(__FILE__);
        $this->plugin_base_path = plugin_dir_path(__FILE__);
        // add custom cron schedules
        $this->filter('cron_schedules', 'add_plugin_cron_schedules');
        $this->setup();
    }
    protected function add_page(string $key, object $value)
    {
        if ($value instanceof Partials) {
            $this->pages[$key] = $value;
        }
    }
    /**
     * Register the stylesheets for the admin area.
     *
     * @since    1.0.0
     */
    public function enqueue_styles()
    {
        $dir = plugin_dir_url(__FILE__) . 'assets/';
        if ($this->is_current_page()) {
            wp_enqueue_style($this->plugin_name . '-animations', $dir . 'css/plugli-animations.css', array(), $this->version, 'all');
            wp_enqueue_style($this->plugin_name . '-fontawesome', $dir . 'fontawesome/css/all.css', array(), $this->version, 'all');
            wp_enqueue_style($this->plugin_name . '-daterangepicker', $dir . 'css/daterangepicker.css', array(), $this->version, 'all');
            wp_enqueue_style($this->plugin_name . '-bootstrap-grid', $dir . 'css/bootstrap-grid.min.css', array(), $this->version, 'all');
            wp_enqueue_style($this->plugin_name . '-bootstrap-utilities', $dir . 'css/bootstrap-utilities.min.css', array(), $this->version, 'all');
            wp_enqueue_style($this->plugin_name . '-modal', $dir . 'css/modal.vue.css', array(), $this->version, 'all');
            wp_enqueue_style($this->plugin_name . '-tooltip', $dir . 'css/tooltip.vue.css', array(), $this->version, 'all');
            wp_enqueue_style($this->plugin_name . '-toast', $dir . 'css/toast.vue.css', array(), $this->version, 'all');
            wp_enqueue_style($this->plugin_name . '-filters-box', $dir . 'css/filters-box.vue.css', array(), $this->version, 'all');
            wp_enqueue_style($this->plugin_name . '-dropdown', $dir . 'css/dropdown.vue.css', array(), $this->version, 'all');
            wp_enqueue_style($this->plugin_name, $dir . 'css/plugli-admin.css', array(), $this->version, 'all');
            wp_enqueue_style($this->plugin_name . '-page-header', $dir . 'css/page-header.css', array(), $this->version, 'all');
        }
        wp_enqueue_style($this->plugin_name . '-general', $dir . 'css/plugli-general.css', array(), $this->version, 'all');
    }
    /**
     * Register the JavaScript for the admin area.
     *
     * @since    1.0.0
     */
    public function enqueue_scripts()
    {
        $dir = plugin_dir_url(__FILE__) . 'assets/js/';
        if ($this->is_current_page()) {
            wp_enqueue_script($this->plugin_name . '-timer', $dir . 'timer.js', array(), $this->version, \false);
            wp_enqueue_script($this->plugin_name . '-storage', $dir . 'storage.js', array(), $this->version, \false);
            wp_enqueue_script($this->plugin_name . '-event-bus', $dir . 'event-bus.js', array(), $this->version, \false);
            wp_enqueue_script($this->plugin_name . '-dateparser', $dir . 'dateparser.js', array(), $this->version, \false);
            wp_enqueue_script($this->plugin_name . '-moment', $dir . 'moment.min.js', array(), $this->version, \false);
            wp_enqueue_script($this->plugin_name . '-vue', $dir . 'vue.global.js', array(), $this->version, \false);
            wp_enqueue_script($this->plugin_name . '-axios', $dir . 'axios.min.js', array(), $this->version, \false);
            wp_enqueue_script($this->plugin_name . '-daterangepicker', $dir . 'daterangepicker.min.js', array(), $this->version, \false);
            wp_enqueue_script($this->plugin_name, $dir . 'plugli-admin.js', array(), $this->version, \false);
            wp_enqueue_script($this->plugin_name . '-toast', $dir . 'toast.vue.js', array(), $this->version, \false);
            wp_enqueue_script($this->plugin_name . '-tooltip', $dir . 'tooltip.vue.js', array(), $this->version, \false);
            wp_enqueue_script($this->plugin_name . '-click-outside', $dir . 'click-outside.vue.js', array(), $this->version, \false);
            wp_enqueue_script($this->plugin_name . '-dom-text', $dir . 'dom-text.vue.js', array(), $this->version, \false);
            wp_enqueue_script($this->plugin_name . '-button', $dir . 'button.vue.js', array(), $this->version, \false);
            wp_enqueue_script($this->plugin_name . '-search', $dir . 'search.vue.js', array(), $this->version, \false);
            wp_enqueue_script($this->plugin_name . '-tab', $dir . 'tab.vue.js', array(), $this->version, \false);
            wp_enqueue_script($this->plugin_name . '-tabbar', $dir . 'tabbar.vue.js', array(), $this->version, \false);
            wp_enqueue_script($this->plugin_name . '-dropdown', $dir . 'dropdown.vue.js', array(), $this->version, \false);
            wp_enqueue_script($this->plugin_name . '-date-picker', $dir . 'datepicker.vue.js', array(), $this->version, \false);
            wp_enqueue_script($this->plugin_name . '-form', $dir . 'form.vue.js', array(), $this->version, \false);
            wp_enqueue_script($this->plugin_name . '-modal', $dir . 'modal.vue.js', array(), $this->version, \false);
            wp_enqueue_script($this->plugin_name . '-filters-box', $dir . 'filters-box.vue.js', array(), $this->version, \false);
            wp_enqueue_script($this->plugin_name . '-page-header', $dir . 'page-header.js', array(), $this->version, \false);
            $this->admin_globals = ['admin_url' => admin_url('admin.php'), 'post_url' => admin_url('post.php'), 'site_url' => get_site_url()];
        }
    }
    /**
     * Used to register the admin menu
     *
     * @return void
     */
    abstract protected function add_menu_page();
    public function add_plugin_admin_menu()
    {
        $this->add_menu_page();
    }
    public function add_plugin_cron_schedules(array $schedules)
    {
        return $schedules;
    }
    abstract protected function setup();
    abstract public function is_current_page($custom_page = \false);
}
