<?php

namespace ModernFields\WordPress\Hooks;

use ModernFields\WordPress\Interfaces\Hooks;

defined('ABSPATH') || exit;

/**
 * Abstract base class for plugin activation and deactivation hooks
 * 
 * This class provides the structure for handling plugin activation and deactivation
 * callbacks registered via WordPress's register_activation_hook() and 
 * register_deactivation_hook() functions.
 * 
 * @since 1.0.0
 */
class Activation implements Hooks
{
  /**
   * Register the hooks for the class
   * 
   * @since 1.0.0
   * @return void
   */
  public function registerHooks(): void
  {
    register_activation_hook(MODERN_FIELDS_PLUGIN_FILE, [$this, 'activate']);
    register_deactivation_hook(MODERN_FIELDS_PLUGIN_FILE, [$this, 'deactivate']);
  }

  /**
   * Handles plugin activation
   * 
   * Called when the plugin is activated. Override this method in a child class
   * to implement custom activation logic such as database setup, default options,
   * or capability registration.
   * 
   * @since 1.0.0
   * @return void
   */
  public function activate(): void
  {
    update_option('modern_fields_test', 'activated');
  }

  /**
   * Handles plugin deactivation
   * 
   * Called when the plugin is deactivated. Override this method in a child class
   * to implement custom deactivation logic such as cleanup tasks or temporary
   * data removal.
   * 
   * @since 1.0.0
   * @return void
   */
  public  function deactivate(): void
  {
    update_option('modern_fields_test', 'deactivated');
  }
}
