import 'package:flutter/material.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'login_screen.dart'; // Import your login screen
import 'home_screen.dart';  // Import your home screen

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

  @override
  Widget build(BuildContext context) {
    return StreamBuilder<User?>(
      stream: FirebaseAuth.instance.authStateChanges(),
      builder: (context, snapshot) {
        // If snapshot has user data, they are logged in
        if (snapshot.hasData) {
          return const HomeScreen();
        }
        // Otherwise, show login
        return const LoginScreen();
      },
    );
  }
}