<?php

/**
 * Core class for the Lockee plugin
 */
class Lockee_Core extends Lockee_Singleton
{

  /**
   * Instances of the various components
   */
  private $metabox;
  private $assets;
  private $shortcode;
  private $ajax;
  private $content;
  private $utils;
  private $migration;
  private $settings;
  private $post_types;
  private $iframe;
  private $block;

  /**
   * Initialize the core
   */
  protected function init()
  {
    $this->load_dependencies();
    $this->init_hooks();
  }

  /**
   * Loads the dependencies of the plugin
   */
  private function load_dependencies()
  {
    require_once plugin_dir_path(dirname(__FILE__)) . 'inc/class-lockee-utils.php';
    require_once plugin_dir_path(dirname(__FILE__)) . 'inc/class-lockee-metabox.php';
    require_once plugin_dir_path(dirname(__FILE__)) . 'inc/class-lockee-assets.php';
    require_once plugin_dir_path(dirname(__FILE__)) . 'inc/class-lockee-shortcode.php';
    require_once plugin_dir_path(dirname(__FILE__)) . 'inc/class-lockee-ajax.php';
    require_once plugin_dir_path(dirname(__FILE__)) . 'inc/class-lockee-content.php';
    require_once plugin_dir_path(dirname(__FILE__)) . 'inc/class-lockee-migration.php';
    require_once plugin_dir_path(dirname(__FILE__)) . 'inc/class-lockee-settings.php';
    require_once plugin_dir_path(dirname(__FILE__)) . 'inc/class-lockee-post-types.php';
    require_once plugin_dir_path(dirname(__FILE__)) . 'inc/class-lockee-iframe.php';
    require_once plugin_dir_path(dirname(__FILE__)) . 'inc/class-lockee-block.php';
    require_once plugin_dir_path(dirname(__FILE__)) . 'inc/class-lockee-hooks.php';

    $this->utils = new Lockee_Utils();
    $this->metabox = Lockee_Metabox::get_instance();
    $this->assets = Lockee_Assets::get_instance();
    $this->shortcode = Lockee_Shortcode::get_instance();
    $this->ajax = Lockee_Ajax::get_instance();
    $this->content = Lockee_Content::get_instance();
    $this->migration = Lockee_Migration::get_instance();
    $this->settings = Lockee_Settings::get_instance();
    $this->post_types = Lockee_Post_Types::get_instance();
    $this->iframe = Lockee_Iframe::get_instance();
    $this->block = Lockee_Block::get_instance();
  }

  /**
   * Initializes the hooks for the plugin
   */
  private function init_hooks()
  {
    Lockee_Hooks::register_all();
  }
}
