import { NextResponse } from "next/server";
import { adminConfigurationStatus, appVersion, checkStorage } from "@/lib/runtime/config";

export async function GET() {
  let storage = "ok";

  try {
    await checkStorage();
  } catch {
    storage = "error";
  }

  return NextResponse.json({
    status: storage === "ok" ? "ok" : "error",
    version: appVersion,
    storage,
    admin: adminConfigurationStatus(),
    timestamp: new Date().toISOString(),
  });
}
