// Generated by bynkc — do not edit by hand.
// composition root for `api` Worker.

import { type ServiceBinding, HttpResult, verifyBearerJwtHs256 } from "../../runtime.js";
import * as handlers from "./handlers.js";

export interface Env {
}

export function compose(env: Env) {
  const deps = {  };
  return {
    async http_GET_ping() {
      return handlers.api.http_GET_ping(deps);
    },
    async http_GET_healthz(request: Request) {
      const __authz = request.headers.get("Authorization");
      if (__authz === null || !__authz.startsWith("Bearer ")) return HttpResult.Unauthorized;
      const __secret = (env as Record<string, unknown>)["AUTH_JWT_SECRET"] ?? (globalThis as { process?: { env?: Record<string, unknown> } }).process?.env?.["AUTH_JWT_SECRET"];
      if (typeof __secret !== "string") return HttpResult.Unauthorized;
      const __claims = await verifyBearerJwtHs256(__authz.slice(7), __secret);
      if (__claims.tag === "Err") return HttpResult.Unauthorized;
      return handlers.api.http_GET_healthz(deps);
    },
  };
}
