import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:navigation/navigation.dart';

class AccountCreatedScreen extends ConsumerWidget {
  final bool kidAccount;
  final NavigationContract navigationContract;

  const AccountCreatedScreen({
    super.key,
    required this.kidAccount,
    required this.navigationContract,
  });

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

    final email = "usuario@example.com";
    final fullName = "Carlos Pérez Cruz";
    final model = "SaveWatch Plus 2";
    final id = "1106652524";

    return Scaffold(
      backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
      body: Container(
        margin: EdgeInsets.all(30),
        child: Center(
          child: Column(
            spacing: 20,
            children: [
              Spacer(flex: 10),
              Icon(
                Icons.check,
                color: theme.getColorFor(ThemeCode.buttonPrimary),
                size: 50,
              ),
              Text(
                "Cuenta creada",
                style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
              ),
              Text.rich(
                textAlign: TextAlign.center,
                TextSpan(
                  text: "Has creado la cuenta para:\n",
                  children: [
                    TextSpan(
                      text: fullName,
                      style: TextStyle(fontWeight: FontWeight.bold),
                    ),
                  ],
                ),
              ),
              if (!kidAccount) Text.rich(
                textAlign: TextAlign.center,
                TextSpan(
                  text: "Hemos enviado un email de verificación a:\n",
                  children: [
                    TextSpan(
                      text: email,
                      style: TextStyle(fontWeight: FontWeight.bold),
                    ),
                  ],
                ),
              ),
              if (kidAccount) Text("Reloj: $model\nID del reloj: $id"),
              Text(
                "Crea la cuenta de tu peque e ingresa su \nprimera paga para utilizarla con su reloj",
                textAlign: TextAlign.center,
              ),
              PrimaryButton(
                onPressed: () => {
                  if (kidAccount){
                    navigationContract.goTo('/main/home')
                  } else {
                    navigationContract.pushTo('/device_signup')
                  }
                },
                text: "Continuar",
                color: theme.getColorFor(ThemeCode.buttonPrimary)
              ),
              Spacer(flex: 8),
            ],
          ),
        ),
      ),
    );
  }
}
