// src/lib/tenant.ts
import { HTTPException } from "hono/http-exception";
var ensureTenantId = (config, tenantId) => {
  const enableTenant = config.tenant?.enabled ?? true;
  if (enableTenant) {
    if (!tenantId) {
      throw new HTTPException(400, {
        message: "Missing tenantId. Tenant isolation is enabled."
      });
    }
    return tenantId;
  }
  if (!config.tenant?.tenantId) {
    throw new HTTPException(500, {
      message: "tenantId must be provided in config.tenant when tenant.enabled is false."
    });
  }
  return config.tenant.tenantId;
};
export {
  ensureTenantId
};
//# sourceMappingURL=tenant.js.map