// app/[lng]/auth/reset-password/components/SuccessPage.tsx

'use client';

import { useEffect } from 'react';
import { useRouter } from 'next/navigation';
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { CheckCircle } from 'lucide-react';
import Link from 'next/link';

interface Props {
  message?: string;
}

export default function SuccessPage({ message }: Props) {
  const router = useRouter();

  // 3초 후 자동 리다이렉트
  useEffect(() => {
    const timer = setTimeout(() => {
      router.push('/parnters');
    }, 3000);

    return () => clearTimeout(timer);
  }, [router]);

  return (
    <Card className="w-full max-w-md">
      <CardHeader className="text-center">
        <div className="mx-auto flex items-center justify-center w-12 h-12 rounded-full bg-green-100 mb-4">
          <CheckCircle className="w-6 h-6 text-green-600" />
        </div>
        <CardTitle className="text-2xl">재설정 완료</CardTitle>
        <CardDescription>
          {message || '비밀번호가 성공적으로 변경되었습니다.'}
        </CardDescription>
      </CardHeader>
      <CardContent>
        <div className="text-center space-y-4">
          <p className="text-sm text-gray-600">
            잠시 후 로그인 페이지로 자동 이동합니다...
          </p>
          <Link href="/auth/login">
            <Button className="w-full">
              지금 로그인하기
            </Button>
          </Link>
        </div>
      </CardContent>
    </Card>
  );
}