<?php

namespace Simplyin\Simplyin_W_Plugin;

use Simplyin\Simplyin_W_Plugin\Admin\SimplyIn_Admin;
use Simplyin\Simplyin_W_Plugin\Sync\Simplyin_Sync;

class Legacy_App {

	/**
	 * The loader that's responsible for maintaining and registering all hooks
	 * that power the plugin.
	 *
	 * @var      SimplyIn_Loader $loader Maintains and registers all hooks for
	 *     the plugin.
	 * @since    1.0.0
	 * @access   protected
	 */
	protected SimplyIn_Loader $loader;

	/**
	 * The unique identifier of this plugin.
	 *
	 * @var      string $plugin_name The string used to uniquely identify this
	 *     plugin.
	 * @since    1.0.0
	 * @access   protected
	 */
	protected string $plugin_name;

	/**
	 * The current version of the plugin.
	 *
	 * @var      string $version The current version of the plugin.
	 * @since    1.0.0
	 * @access   protected
	 */
	protected string $version;

	/**
	 * @var Simplyin_Sync
	 */
	public Simplyin_Sync $sync;

	public function __construct() {
		$this->plugin_name = 'simplyin';
		$this->version     = SimplyInGetPluginVersion();

		$this->load_dependencies();
		$this->define_admin_hooks();
		$this->define_sync_hooks();
	}

	private function load_dependencies(): void {

		$this->loader = new SimplyIn_Loader();
	}

	private function define_admin_hooks(): void {

		new SimplyIn_Admin( $this->get_plugin_name(), $this->get_version() );
	}

	private function define_sync_hooks(): void {
		$this->sync = new Simplyin_Sync(
			$this->get_plugin_name(),
			$this->get_version()
		);
	}

	public function run(): void {
		$this->loader->run();
	}

	public function get_plugin_name(): string {
		return $this->plugin_name;
	}

	public function get_version(): string {
		return $this->version;
	}
}
