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

export const REQUEST_TIMEOUT_METADATA = 'request_timeout_ms';

/** Override the global request timeout for a controller or a single route. */
export const RequestTimeout = (timeoutMs: number) =>
  SetMetadata(REQUEST_TIMEOUT_METADATA, timeoutMs);

/** Disable the application-level timeout for a route that intentionally streams indefinitely. */
export const DisableRequestTimeout = () => SetMetadata(REQUEST_TIMEOUT_METADATA, 0);
