'use strict';

var chunk67M7TOOV_cjs = require('./chunk-67M7TOOV.cjs');
var chunkAF3E2D32_cjs = require('./chunk-AF3E2D32.cjs');

// src/prepare/runtime/runtime/shared/request.ts
function writeRequest() {
  return `${chunk67M7TOOV_cjs.getFileHeader()}

import { uniqueId } from "./id";
import type { IStormRequest } from "@storm-stack/types/request";

/**
 * A base request class used by the Storm Stack runtime.
 */
export class StormRequest<
  TData = any,
  TIdentifiers extends Record<string, any> = Record<string, any>,
  TParams extends Record<string, any> = Record<string, any>,
  TMeta extends Record<string, any> = Record<string, any>
> implements IStormRequest<TData, TIdentifiers, TParams, TMeta> {
  /**
   * The payload data associated with the request.
   */
  public readonly data: TData;

  /**
   * Any identifiers associated with the request.
   */
  public readonly identifiers: TIdentifiers;

  /**
   * Any parameters associated with the request.
   */
  public readonly params?: TParams;

  /**
   * The metadata associated with the request.
   */
  public readonly meta: TMeta;

  /**
   * The request identifier.
   */
  public readonly id = uniqueId();

  /**
   * The request created timestamp.
   */
  public readonly timestamp = Date.now();

  /**
   * Create a new request object.
   *
   * @param data - The request data.
   * @param identifiers - The request identifiers.
   * @param meta - The request metadata.
   * @param params - The request parameters.
   */
  public constructor(
    data: TData,
    identifiers = {} as TIdentifiers,
    meta = {} as TMeta,
    params?: TParams
  ) {
    this.data = data;
    this.identifiers = identifiers;
    this.meta = meta as TMeta;
    this.params = params;
  }
}
  `;
}
chunkAF3E2D32_cjs.__name(writeRequest, "writeRequest");

exports.writeRequest = writeRequest;
//# sourceMappingURL=chunk-2WCJPMYO.cjs.map
//# sourceMappingURL=chunk-2WCJPMYO.cjs.map