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

export const OPERATION_LOG_METADATA = Symbol('OPERATION_LOG_METADATA');

export type OperationLogOptions = {
  action: string;
  resourceType?: string;
  resourceIdParam?: string;
  resourceIdFromResult?: string;
  metadataFromBody?: string[];
  metadataFromQuery?: string[];
  description?: string;
};

export function OperationLog(options: OperationLogOptions) {
  return SetMetadata(OPERATION_LOG_METADATA, options);
}
