import { SetMetadata } from '@nestjs/common';

export const PERMISSION_METADATA_KEY = 'ftb:required-permission';

export interface PermissionScopeOptions {
  productIdParam?: string;
  projectIdParam?: string;
  versionIdParam?: string;
}

export interface RequiredPermissionMetadata extends PermissionScopeOptions {
  permission: string;
}

export function RequirePermission(permission: string, scope: PermissionScopeOptions = {}) {
  return SetMetadata(PERMISSION_METADATA_KEY, { permission, ...scope });
}
