import 'package:flutter/material.dart';
// import '../../theme/app_colors.dart';
import '../../widgets/themed_text.dart';
import '../../widgets/common/buttons/primary_button.dart';
import '../../widgets/native_ad_widget.dart';
import '../../l10n/app_localizations.dart';

class ScanInitialWidget extends StatelessWidget {
  final VoidCallback onScanPressed;
  final String? errorMessage;

  const ScanInitialWidget({
    super.key,
    required this.onScanPressed,
    this.errorMessage,
  });

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Padding(
          padding: const EdgeInsets.symmetric(horizontal: 16.0),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              if (errorMessage != null)
                Padding(
                  padding: const EdgeInsets.only(bottom: 24.0),
                  child: ThemedText(
                    errorMessage!,
                    color: Theme.of(context).colorScheme.error,
                    textAlign: TextAlign.center,
                  ),
                ),
              ThemedText(
                AppLocalizations.of(context).findRepeatSubscriptions,
                fontSize: 20,
                fontWeight: FontWeight.bold,
                forceDark: true,
              ),
              const SizedBox(height: 16),
              Padding(
                padding: const EdgeInsets.symmetric(horizontal: 16.0),
                child: ThemedText(
                  AppLocalizations.of(context).scanTextMessages,
                  textAlign: TextAlign.center,
                  opacity: 0.7,
                  forceDark: true,
                ),
              ),
              const SizedBox(height: 32),
              PrimaryButton(
                text: AppLocalizations.of(context).startScanning,
                icon: Icons.search_rounded,
                onPressed: onScanPressed,
                width: 200,
                height: 56,
                backgroundColor: Theme.of(context).colorScheme.primary,
              ),
            ],
          ),
        ),
        const SizedBox(height: 32),
        const NativeAdWidget(key: ValueKey('sms_scan_start_ad')),
      ],
    );
  }
}
