<?php
/**
 * Module Registered Event
 *
 * Dispatched when a module is registered with the plugin system.
 * Provides details about the registered module including its identifier,
 * class name, and functional domain.
 *
 * @package     WPUltimateSecurity\UltimateSecurity\Events
 * @since       2.0.0
 */

declare(strict_types=1);

namespace WPUltimateSecurity\UltimateSecurity\Events;

/**
 * Event dispatched when a module is registered.
 *
 * This event enables subscribers to react to module registration,
 * allowing for dynamic configuration, dependency injection, or
 * logging of module initialization.
 *
 * @since 2.0.0
 */
class ModuleRegisteredEvent extends AbstractEvent
{
    /**
     * The event name constant.
     *
     * @since 2.0.0
     *
     * @var string
     */
    public const NAME = 'module.registered';

    /**
     * Create a new ModuleRegisteredEvent instance.
     *
     * @since 2.0.0
     *
     * @param string $moduleId    The unique identifier for the module.
     * @param string $moduleClass The fully qualified class name of the module.
     * @param string $domain      The functional domain the module belongs to
     *                            (e.g., 'authentication', 'protection', 'monitoring').
     */
    public function __construct(
        string $moduleId,
        string $moduleClass,
        string $domain
    ) {
        parent::__construct(self::NAME, [
            'moduleId'    => $moduleId,
            'moduleClass' => $moduleClass,
            'domain'      => $domain,
        ]);
    }

    /**
     * Get the module identifier.
     *
     * @since 2.0.0
     *
     * @return string The unique module identifier.
     */
    public function getModuleId(): string
    {
        return $this->payload['moduleId'];
    }

    /**
     * Get the module class name.
     *
     * @since 2.0.0
     *
     * @return string The fully qualified class name of the module.
     */
    public function getModuleClass(): string
    {
        return $this->payload['moduleClass'];
    }

    /**
     * Get the module domain.
     *
     * @since 2.0.0
     *
     * @return string The functional domain the module belongs to.
     */
    public function getDomain(): string
    {
        return $this->payload['domain'];
    }
}
