/**
 * Subscription Management Page
 *
 * Redirects to Organization settings with Subscription tab
 */

'use client';

import { useEffect } from 'react';
import { useRouter, useSearchParams } from 'next/navigation';

export default function SubscriptionPage() {
  const router = useRouter();
  const searchParams = useSearchParams();

  useEffect(() => {
    // Preserve any query parameters (success, canceled) from Stripe redirects
    const params = searchParams.toString();
    const redirectUrl = `/dashboard/settings/organization${params ? `?${params}` : ''}`;
    router.replace(redirectUrl);
  }, [router, searchParams]);

  return (
    <div className="flex items-center justify-center min-h-screen">
      <div className="text-center">
        <div className="inline-block animate-spin rounded-full h-12 w-12 border-b-4 border-blue-600 mb-4"></div>
        <p className="text-gray-600">Redirection...</p>
      </div>
    </div>
  );
}
