import { createParamDecorator, ExecutionContext } from '@nestjs/common'

export interface CurrentUserData {
  userId: string
  accountSequence?: string
  walletAddress?: string
  roles?: string[]
}

export const CurrentUser = createParamDecorator(
  (data: unknown, ctx: ExecutionContext): CurrentUserData => {
    const request = ctx.switchToHttp().getRequest()
    return request.user
  },
)
