"use client";

import Link from "next/link";
import { useAuth } from "@/components/auth-provider";

export function OrderActivation({ slug, canActivate }: { slug: string; canActivate: boolean }) {
  const { setAccessLevel } = useAuth();

  if (!canActivate) {
    return <Link href={`/apps/${slug}`} className="cta-main">返回资源详情</Link>;
  }

  return (
    <Link
      href={`/apps/${slug}`}
      onClick={() => setAccessLevel("vip")}
      className="cta-main"
    >
      激活 VIP 并返回资源详情
    </Link>
  );
}
