import 'package:auth/src/recover_password/presentation/new_password_screen.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

class SentScreen extends ConsumerWidget {
  final String format;

  const SentScreen({
    super.key,
    required this.format
  });

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final theme = ref.watch(themePortProvider);

    return Scaffold(
      backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
      body: Container(
        margin: EdgeInsets.all(24),
        child: Center(
          child: Column(
            spacing: 48,
            children: [
              Spacer(flex: 8),
              Text(
                "Recuperar contraseña",
                textAlign: TextAlign.center,
                style: TextStyle(fontWeight: FontWeight.w500, fontSize: 30, letterSpacing: 0),
              ),
              Row(
                spacing: 10,
                children: [
                  Spacer(),
                  Icon(
                    Icons.check,
                    color: theme.getColorFor(ThemeCode.buttonPrimary),
                  ),
                  Text(
                    format=="email"
                      ?"Correo enviado correctamente"
                      :"SMS enviado correctamente",
                    style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
                  ),
                  Spacer(),
                ],
              ),
              Column(
                spacing: 16,
                children: [
                  Text(
                    format=="email"
                      ?"Revisa tu email y haz clic en el enlace para crear una nueva contraseña."
                      :"Revisa tu móvil y sigue las instrucciones para crear una nueva contraseña.",
                    textAlign: TextAlign.center,
                    style: TextStyle(fontSize: 18, letterSpacing: 0),
                  ),
                  Text(
                    format=="email"
                    ?"Si no recibes el correo en unos minutos, revisa tu carpeta de spam o pulsa \"Reenviar correo\"."
                    :"Si no recibes el SMS en unos minutos, asegúrate de tener cobertura o pulsa \"Reenviar SMS \".",
                    textAlign: TextAlign.center,
                    style: TextStyle(fontSize: 14, letterSpacing: 0),
                  ),
                ],
              ),
              Row(
                spacing: 10,
                children: [
                  Expanded( child: SecondaryButton(
                    onPressed: () => {},
                    text: format=="email"
                      ?"Reenviar correo"
                      :"Reenviar SMS"
                  )),
                  Expanded(
                    child: PrimaryButton(
                      onPressed: ()=>Navigator.push(
                        context,
                        MaterialPageRoute(
                          builder: (_) => NewPasswordScreen(),
                        ),
                      ),
                      text: "Continuar",
                      color: theme.getColorFor(ThemeCode.buttonSecondary)
                    ),
                  ),
                ],
              ),
              Spacer(flex: 10),
            ],
          ),
        ),
      ),
    );
  }
}
