import { NextRequest, NextResponse } from "next/server";
import { requireAuth } from "@/lib/auth";

export async function GET(request: NextRequest) {
  try {
    const auth = await requireAuth(request);
    if (!auth) {
      return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
    }

    const isPremium = auth.isPremium || auth.isPro;
    const multiplier = isPremium ? 2 : 1;
    const reason = isPremium
      ? "Premium/Pro members earn 2x FLH on marketplace sales"
      : "Free members earn 1x FLH. Upgrade to Premium for 2x!";

    return NextResponse.json({ multiplier, reason });
  } catch (error) {
    console.error("GET /api/premium/flh-multiplier error:", error);
    return NextResponse.json(
      { error: "Internal server error" },
      { status: 500 }
    );
  }
}
