import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

import 'core/config/router.dart';
import 'core/theme/app_theme.dart';
import 'features/auth/presentation/bloc/auth_cubit.dart';

class FinSimApp extends StatefulWidget {
  final AuthCubit authCubit;

  const FinSimApp({super.key, required this.authCubit});

  @override
  State<FinSimApp> createState() => _FinSimAppState();
}

class _FinSimAppState extends State<FinSimApp> {
  late final AppRouter _appRouter;

  @override
  void initState() {
    super.initState();
    _appRouter = AppRouter(widget.authCubit);
  }

  @override
  Widget build(BuildContext context) {
    return BlocProvider<AuthCubit>.value(
      value: widget.authCubit,
      child: MaterialApp.router(
        title: 'FinSim',
        debugShowCheckedModeBanner: false,
        theme: AppTheme.dark,
        routerConfig: _appRouter.router,
      ),
    );
  }
}