text: import uuid
  from fastapi import Depends, Request, APIRouter
  from typing import Optional
  from fastapi_users import BaseUserManager, FastAPIUsers, UUIDIDMixin
  from fastapi_users.authentication.strategy.db import AccessTokenDatabase, DatabaseStrategy
  from fastapi_users.authentication import AuthenticationBackend, BearerTransport, JWTStrategy, CookieTransport
  from app.models import UserUpdate, UserRead
  
  from app.models import UserCreate
  from app.database import AccessToken, get_access_token_db, User, get_user_db
  import os
  
  SECRET = os.environ['SECRET']
  
  cookie_transport = CookieTransport(cookie_max_age=3600)
  
  bearer_transport = BearerTransport(tokenUrl="auth/jwt/login")
  
  
  def get_jwt_strategy() -> JWTStrategy:
      return JWTStrategy(secret=SECRET, lifetime_seconds=3600)
  
  
  def get_database_strategy(
      access_token_db: AccessTokenDatabase[AccessToken] = Depends(get_access_token_db),
  ) -> DatabaseStrategy:
      return DatabaseStrategy(access_token_db, lifetime_seconds=3600)
  
  
  jwt_auth_backend = AuthenticationBackend(
      name="jwt",
      transport=bearer_transport,
      get_strategy=get_database_strategy,
  )
  cookie_auth_backend = AuthenticationBackend(
      name="cookie",
      transport=cookie_transport,
      get_strategy=get_database_strategy,
  )
  
  
  class UserManager(UUIDIDMixin, BaseUserManager[User, uuid.UUID]):
      reset_password_token_secret = SECRET
      verification_token_secret = SECRET
  
      async def on_after_register(self, user: User, request: Optional[Request] = None):
          print(f"User {user.id} has registered.")
  
      async def on_after_forgot_password(
          self, user: User, token: str, request: Optional[Request] = None
      ):
          print(f"User {user.id} has forgot their password. Reset token: {token}")
  
      async def on_after_request_verify(
          self, user: User, token: str, request: Optional[Request] = None
      ):
          print(f"Verification requested for user {user.id}. Verification token: {token}")
  
  
  async def get_user_manager(user_db=Depends(get_user_db)):
      yield UserManager(user_db)
  
  
  fastapi_users = FastAPIUsers[User, uuid.UUID](
      get_user_manager,
      [cookie_auth_backend, jwt_auth_backend],
  )
  
  router = APIRouter()
  router.include_router(
      fastapi_users.get_auth_router(jwt_auth_backend),
      prefix="/auth/jwt",
      tags=["auth"],
  )
  router.include_router(
      fastapi_users.get_auth_router(cookie_auth_backend),
      prefix="/auth/cookie",
      tags=["auth"],
  )
  router.include_router(
      fastapi_users.get_register_router(UserRead, UserCreate),
      prefix="/auth",
      tags=["auth"],
  )
  router.include_router(
      fastapi_users.get_reset_password_router(),
      prefix="/auth",
      tags=["auth"],
  )
  router.include_router(
      fastapi_users.get_verify_router(UserRead),
      prefix="/auth",
      tags=["auth"],
  )
  router.include_router(
      fastapi_users.get_users_router(UserRead, UserUpdate),
      prefix="/users",
      tags=["users"],
  )
  
  
  # async def get_enabled_backends(request: Request):
  #     """Return the enabled dependencies following custom logic."""
  #     if request.url.path == "/protected-route-only-jwt":
  #         return [jwt_auth_backend]
  #     else:
  #         return [cookie_auth_backend, jwt_auth_backend]
  
  current_active_user = fastapi_users.current_user(active=True)
  
  