import 'package:flutter/material.dart';

import 'package:pweb/app/router/pages.dart';
import 'package:pweb/widgets/vspacer.dart';

import 'package:pweb/generated/i18n/app_localizations.dart';


class SignupConfirmationLoginPrompt extends StatelessWidget {
  final bool isEmbedded;

  const SignupConfirmationLoginPrompt({
    super.key,
    this.isEmbedded = false,
  });

  @override
  Widget build(BuildContext context) {
    final theme = Theme.of(context);
    final colorScheme = theme.colorScheme;
    final locs = AppLocalizations.of(context)!;

    final content = Column(
      crossAxisAlignment: CrossAxisAlignment.center,
      children: [
        Container(
          width: 44,
          height: 44,
          decoration: BoxDecoration(
            color: colorScheme.secondary.withValues(alpha: 0.12),
            borderRadius: BorderRadius.circular(12),
          ),
          child: Icon(
            Icons.lock_open_outlined,
            color: colorScheme.secondary,
          ),
        ),
        const VSpacer(),
        Text(
          locs.signupConfirmationLoginTitle,
          textAlign: TextAlign.center,
          style: theme.textTheme.titleLarge?.copyWith(
            fontWeight: FontWeight.w700,
          ),
        ),
        const VSpacer(),
        Text(
          locs.signupConfirmationLoginHint,
          textAlign: TextAlign.center,
          style: theme.textTheme.bodyMedium,
        ),
        const VSpacer(multiplier: 1.5),
        OutlinedButton.icon(
          onPressed: () => navigate(context, Pages.login),
          icon: const Icon(Icons.login),
          label: Text(locs.login),
        ),
      ],
    );

    if (isEmbedded) return content;

    return Card(
      elevation: 0,
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(18),
        side: BorderSide(
          color: theme.dividerColor.withValues(alpha: 0.5),
        ),
      ),
      child: Padding(
        padding: const EdgeInsets.all(24),
        child: content,
      ),
    );
  }
}
