type PushConfig = {
  enabled: boolean;
  vapidPublicKey: string | null;
};

type AdminRuntimeConfig = {
  push: PushConfig;
};

export function getAdminRuntimeConfig(): AdminRuntimeConfig {
  const raw = typeof window !== 'undefined' ? window.__ADMIN_RUNTIME_CONFIG__ : undefined;

  return {
    push: {
      enabled: Boolean(raw?.push?.enabled),
      vapidPublicKey: raw?.push?.vapidPublicKey ?? null,
    },
  };
}

export function getAdminPushConfig(): PushConfig {
  return getAdminRuntimeConfig().push;
}
