import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../services/authentication_manager.dart';
import 'auth_view.dart';
import 'main_view.dart';

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

  @override
  Widget build(BuildContext context) {
    final authManager = context.watch<AuthenticationManager>();

    // Show loading indicator while initializing
    if (authManager.isInitializing) {
      return const Scaffold(
        body: Center(
          child: CircularProgressIndicator(),
        ),
      );
    }

    // Show main view if authenticated, otherwise show login
    if (authManager.isAuthenticated) {
      return const MainView();
    } else {
      return const AuthView();
    }
  }
}
