<?php
/**
 * Plugin Lifecycle Hook
 *
 * @category   WordPress_Plugin
 * @package    Common
 * @subpackage Hooks
 * @author     miniOrange <info@miniorange.com>
 * @license    MIT/Expat
 * @link       https://plugins.miniorange.com/woocommerce-api-product-sync-with-woocommerce-rest-apis
 */

namespace MOWCPS\Common\Hooks;

use MOWCPS\Common\Constants\Constants;
use MOWCPS\Common\Interfaces\Hookable_Interface;
use MOWCPS\Common\Handlers\Plugin_Lifecycle_Handler;

if ( ! defined( 'ABSPATH' ) ) {
	die;
}

/**
 * Class Plugin_Lifecycle
 *
 * Handles plugin lifecycle hooks (activation, deactivation, uninstall)
 */
class Plugin_Lifecycle implements Hookable_Interface {
	/**
	 * Plugin file path
	 *
	 * @var string
	 */
	private $plugin_file;

	/**
	 * Initialize the plugin lifecycle hooks
	 */
	public function __construct() {
		$this->plugin_file = MOWCPS_PLUGIN_DIR . Constants::PLUGIN_FILE;
		$this->register_hooks();
	}

	/**
	 * Register lifecycle hooks
	 *
	 * @return void
	 */
	public function register_hooks() {
		register_activation_hook( $this->plugin_file, array( $this, 'on_plugin_activation' ) );
		register_deactivation_hook( $this->plugin_file, array( $this, 'on_plugin_deactivation' ) );
	}

	/**
	 * Handle plugin deactivation
	 *
	 * @return void
	 */
	public function on_plugin_deactivation() {
		$handler = new Plugin_Lifecycle_Handler();
		$handler->handle_deactivation();
	}

	/**
	 * Handle plugin activation (placeholder for future use)
	 *
	 * @return void
	 */
	public function on_plugin_activation() {
		$handler = new Plugin_Lifecycle_Handler();
		$handler->handle_activation();
	}

	/**
	 * Handle plugin uninstall (placeholder for future use)
	 *
	 * @return void
	 */
	public function on_plugin_uninstall() {
		$handler = new Plugin_Lifecycle_Handler();
		$handler->handle_uninstall();
	}
}
