import { b as private_env, j as json } from './shared-server-sSGG17Df.js';
import { v as validateAuth } from './auth-DeCdZ83n.js';
import 'crypto';

const GET = ({ request, url }) => {
  const wantsDetails = url.searchParams.get("details") === "true";
  if (wantsDetails) {
    const authError = validateAuth(request);
    if (authError) {
      return authError;
    }
  }
  const hasProjectId = !!private_env.FCM_PROJECT_ID?.trim();
  const hasClientEmail = !!private_env.FCM_CLIENT_EMAIL?.trim();
  const hasPrivateKey = !!private_env.FCM_PRIVATE_KEY?.trim();
  const checks = {
    hasApiKey: !!private_env.API_KEY?.trim(),
    hasAPNsConfig: !!(private_env.APNS_KEY_ID?.trim() && private_env.APNS_TEAM_ID?.trim() && private_env.APNS_KEY?.trim()),
    hasBundleId: !!private_env.APNS_BUNDLE_ID?.trim(),
    hasDeviceToken: !!private_env.DEVICE_TOKEN?.trim(),
    hasFCMConfig: hasProjectId && hasClientEmail && hasPrivateKey
  };
  const fcm = {
    configured: hasProjectId && hasClientEmail && hasPrivateKey,
    hasClientEmail,
    hasPrivateKey,
    hasProjectId
  };
  const configuration = {
    apnsKeyId: private_env.APNS_KEY_ID ? `${private_env.APNS_KEY_ID.substring(0, 4)}...` : "",
    bundleId: private_env.APNS_BUNDLE_ID || "",
    deviceTokenLength: private_env.DEVICE_TOKEN ? private_env.DEVICE_TOKEN.length : 0,
    fcm,
    production: private_env.APNS_PRODUCTION === "true"
  };
  const warnings = [];
  if (!checks.hasAPNsConfig || !checks.hasBundleId) {
    warnings.push("APNs not configured — iOS push notifications disabled");
  }
  if (!checks.hasDeviceToken) {
    warnings.push("No device token set — push notifications have no target");
  }
  if (!checks.hasFCMConfig) {
    warnings.push("FCM not configured — Android push notifications disabled");
  }
  const health = {
    checks,
    configuration,
    environment: private_env.NODE_ENV || "development",
    status: "healthy",
    timestamp: (/* @__PURE__ */ new Date()).toISOString(),
    version: "1.1.0",
    warnings
  };
  if (!wantsDetails) {
    return json({ status: health.status, timestamp: health.timestamp, warnings: health.warnings });
  }
  return json(health);
};

export { GET };
//# sourceMappingURL=_server.ts-DhTrdlWH.js.map
