import {
  tokenKey
} from "./chunk-GYGNEQSC.js";

// runtime/subsystems/jobs/job-handler.base.ts
var ParentClosePolicy = /* @__PURE__ */ ((ParentClosePolicy2) => {
  ParentClosePolicy2["Terminate"] = "terminate";
  ParentClosePolicy2["Cancel"] = "cancel";
  ParentClosePolicy2["Abandon"] = "abandon";
  return ParentClosePolicy2;
})(ParentClosePolicy || {});
var JobHandlerBase = class {
};
var JOB_HANDLER_REGISTRY = /* @__PURE__ */ new Map();
var JOB_HANDLER_METADATA_KEY = Symbol.for(tokenKey("jobs", "handler-metadata"));
function JobHandler(type, meta) {
  return (target) => {
    if (JOB_HANDLER_REGISTRY.has(type)) {
      const env = process.env.NODE_ENV;
      if (env === "production") {
        throw new Error(
          `[JobHandler] Duplicate registration for job type '${type}'. Each @JobHandler must declare a unique type.`
        );
      }
      if (env !== "test") {
        console.warn(
          `[JobHandler] Duplicate registration for job type '${type}'. Overwriting previous handler \u2014 this is almost certainly a bug.`
        );
      }
    }
    Reflect.defineMetadata(JOB_HANDLER_METADATA_KEY, { type, meta }, target);
    JOB_HANDLER_REGISTRY.set(type, {
      type,
      meta,
      handlerClass: target
    });
  };
}
var HandlerRegistry;
((HandlerRegistry2) => {
  function getAll() {
    return Array.from(JOB_HANDLER_REGISTRY.values());
  }
  HandlerRegistry2.getAll = getAll;
  function get(type) {
    return JOB_HANDLER_REGISTRY.get(type);
  }
  HandlerRegistry2.get = get;
})(HandlerRegistry || (HandlerRegistry = {}));

export {
  ParentClosePolicy,
  JobHandlerBase,
  JOB_HANDLER_REGISTRY,
  JOB_HANDLER_METADATA_KEY,
  JobHandler,
  HandlerRegistry
};
//# sourceMappingURL=chunk-CO6LUM72.js.map