import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:userfront/core/i18n/locale_utils.dart';
import 'package:userfront/i18n.dart';

class LoginSuccessScreen extends StatelessWidget {
  const LoginSuccessScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Padding(
          padding: const EdgeInsets.all(24.0),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              const Icon(
                Icons.check_circle_outline,
                size: 80,
                color: Colors.green,
              ),
              const SizedBox(height: 24),
              Text(
                tr('ui.userfront.login_success.title'),
                style: const TextStyle(
                  fontSize: 32,
                  fontWeight: FontWeight.bold,
                ),
              ),
              const SizedBox(height: 16),
              Text(
                tr('msg.userfront.login_success.subtitle'),
                textAlign: TextAlign.center,
                style: const TextStyle(color: Colors.grey, fontSize: 16),
              ),
              const SizedBox(height: 48),

              // 이 버튼이 QR 카메라를 켜는 버튼입니다.
              FilledButton.icon(
                onPressed: () {
                  context.push('/scan');
                },
                icon: const Icon(Icons.camera_alt, size: 28),
                label: Text(tr('ui.userfront.login_success.qr')),
                style: FilledButton.styleFrom(
                  minimumSize: const Size.fromHeight(80), // 버튼 높이를 더 크게
                  backgroundColor: Colors.blue.shade700,
                  textStyle: const TextStyle(
                    fontSize: 20,
                    fontWeight: FontWeight.bold,
                  ),
                  shape: RoundedRectangleBorder(
                    borderRadius: BorderRadius.circular(16),
                  ),
                ),
              ),
              const SizedBox(height: 24),
              TextButton(
                onPressed: () {
                  context.go(buildLocalizedHomePath(Uri.base));
                },
                child: Text(
                  tr('ui.userfront.login_success.later'),
                  style: const TextStyle(color: Colors.grey),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
