import { Result } from '@core/shared/application/Result';

export interface PasswordResetRequest {
  email: string;
  token: string;
  expiresAt: Date;
  userId: string;
  used?: boolean;
}

export interface IMagicLinkRepository {
  /**
   * Create a password reset request
   */
  createPasswordResetRequest(request: PasswordResetRequest): Promise<void>;

  /**
   * Find a password reset request by token
   */
  findByToken(token: string): Promise<PasswordResetRequest | null>;

  /**
   * Mark a token as used
   */
  markAsUsed(token: string): Promise<void>;

  /**
   * Check rate limiting for an email
   * Returns Result.ok if allowed, Result.err if rate limited
   */
  checkRateLimit(email: string): Promise<Result<void, { message: string }>>;

  /**
   * Clean up expired tokens
   */
  cleanupExpired(): Promise<void>;
}