import { createParamDecorator, type ExecutionContext } from '@nestjs/common';
import type { FamilyActorContext } from '../common/family-actor-context.js';

/**
 * 读取当前已认证的 C 端小程序账号上下文。
 */
export const CurrentFamilyActor = createParamDecorator(
  (_data: unknown, ctx: ExecutionContext): FamilyActorContext | undefined => {
    const request = ctx
      .switchToHttp()
      .getRequest<{ familyActor?: FamilyActorContext }>();
    return request.familyActor;
  },
);
