/**
 * GET /api/eterra/health — eTerra platform availability check.
 *
 * Returns health status without requiring authentication.
 * Triggers a fresh check if cached result is stale.
 *
 * POST /api/eterra/health — force an immediate fresh check.
 */

import { NextResponse } from "next/server";
import {
  getEterraHealth,
  checkEterraHealthNow,
} from "@/modules/parcel-sync/services/eterra-health";

export const runtime = "nodejs";
export const dynamic = "force-dynamic";

export async function GET() {
  const health = getEterraHealth();
  return NextResponse.json(health);
}

export async function POST() {
  const health = await checkEterraHealthNow();
  return NextResponse.json(health);
}
