import crypto from "node:crypto";
function stableUuidFromString(input) {
  const bytes = crypto.createHash("sha256").update(input).digest().subarray(0, 16);
  bytes[6] = bytes[6] & 15 | 80;
  bytes[8] = bytes[8] & 63 | 128;
  const hex = Buffer.from(bytes).toString("hex");
  return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20, 32)}`;
}
const setup = {
  defaultRoleFeatures: {
    superadmin: ["integrations.*", "integrations.view", "integrations.manage", "integrations.credentials.manage"],
    admin: ["integrations.*", "integrations.view", "integrations.manage", "integrations.credentials.manage"],
    employee: ["integrations.view"]
  },
  async seedDefaults({ container, organizationId, tenantId }) {
    const cradle = container;
    if (typeof cradle.hasRegistration !== "function" || !cradle.hasRegistration("schedulerService")) {
      return;
    }
    const schedulerService = container.resolve("schedulerService");
    await schedulerService.register({
      id: stableUuidFromString(`integrations:health-probe:${tenantId}`),
      name: "Integration health probes",
      description: "Runs outbound health checks for enabled integrations every 15 minutes.",
      scopeType: "organization",
      organizationId,
      tenantId,
      scheduleType: "interval",
      scheduleValue: "15m",
      timezone: "UTC",
      targetType: "queue",
      targetQueue: "integration-health-probe",
      targetPayload: {
        scope: { organizationId, tenantId }
      },
      sourceType: "module",
      sourceModule: "integrations",
      isEnabled: true
    });
  }
};
var setup_default = setup;
export {
  setup_default as default,
  setup
};
//# sourceMappingURL=setup.js.map
