'use strict';

var chunkXCPPXOG6_cjs = require('./chunk-XCPPXOG6.cjs');
var chunkAF3E2D32_cjs = require('./chunk-AF3E2D32.cjs');

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

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

/**
 * 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: TIdentifiers,
    meta = {},
    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-SK5IZL6A.cjs.map
//# sourceMappingURL=chunk-SK5IZL6A.cjs.map