// import { UsersEntity } from 'src/entities/Users.entity';

/**
 * ResetPassEvent - Domain event for password reset operations
 *
 * This event class represents a password reset request in the application's
 * event-driven architecture. It encapsulates the data needed to process
 * password reset operations and can be emitted to trigger side effects
 * like sending reset emails, logging, or auditing.
 *
 * Domain events like this follow the principles of Event-Driven Architecture (EDA)
 * to decouple business logic and enable asynchronous processing of side effects.
 *
 * Typical usage flow:
 * 1. User requests password reset → ResetPassEvent is created
 * 2. Event is emitted via EventEmitter
 * 3. Event handlers process the event (send email, log activity, etc.)
 *
 * @example
 * // Creating and emitting the event
 * const resetEvent = new ResetPassEvent(resetToken, 'dm');
 * this.eventEmitter.emit('reset.password', resetEvent);
 *
 * @example
 * // Handling the event in a listener
 * @OnEvent('reset.password')
 * handleResetPasswordEvent(event: ResetPassEvent) {
 *   await this.emailService.sendPasswordResetEmail(
 *     event.token,
 *     event.flag
 *   );
 * }
 */
export class ResetPassEvent {
  /**
   * Creates a new ResetPassEvent instance
   *
   * @param token - Password reset verification token
   * @param flag - System flag indicating reset method/configuration
   */
  constructor(
    // Optional: User entity reference
    // public user: UsersEntity | undefined | null,

    /**
     * Password reset verification token
     *
     * A secure, time-limited token used to verify the password reset request.
     * Typically:
     * - Generated when user requests password reset
     * - Sent to user via email or SMS
     * - Validated before allowing password change
     * - Single-use and expires after short period
     *
     * @note Consider making this required (remove null) for type safety
     *
     * @example "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
     * @example "abc123def456"
     */
    public token: string | null,

    /**
     * System flag indicating reset configuration
     *
     * Determines which password reset workflow or system to use.
     * Can affect:
     * - Email template selection
     * - Reset link format
     * - Token validation method
     * - Logging/auditing strategy
     *
     * Common values:
     * - 'dm': Direct method (standard password reset)
     * - 'guglu': Alternative method (legacy system, partner integration, etc.)
     *
     * @note Consider using an enum for type safety: ResetFlag
     *
     * @example "dm"
     * @example "guglu"
     */
    public flag: string | null,
  ) {}
}
