// SPDX-FileCopyrightText: 2026 FocusFlow contributors
// SPDX-License-Identifier: AGPL-3.0-only

/// Composes the FocusFlow Flutter application around Focus Flow App.
library;

import 'dart:async';

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

import '../controllers/backlog_board_controller.dart';
import '../controllers/scheduler_command_controller.dart';
import '../controllers/selected_date_controller.dart';
import '../controllers/today_screen_controller.dart';
import '../models/navigation/focus_flow_section.dart';
import '../models/today_screen_models.dart';
import '../theme/focus_flow_theme.dart';
import '../theme/focus_flow_tokens.dart';
import '../widgets/app_shell.dart';
import '../widgets/backlog/backlog_board_screen.dart';
import '../widgets/required_banner.dart';
import '../widgets/sidebar.dart';
import '../widgets/task_selection_modal.dart';
import '../widgets/timeline/timeline_view.dart';
import '../widgets/top_bar.dart';
import 'scheduler_app_composition.dart';

part 'home/focus_flow_home.dart';
part 'home/focus_flow_home_state.dart';
part 'home/plan_issue.dart';
part 'home/today_screen_scaffold.dart';
part 'home/today_screen_scaffold_state.dart';

/// Root Material app for the FocusFlow desktop UI.
class FocusFlowApp extends StatelessWidget {
  /// Creates a FocusFlow app from an application composition.
  const FocusFlowApp({required this.composition, super.key});

  /// Factory and controller bundle used by the app tree.
  final SchedulerAppComposition composition;

  /// Builds the widget subtree for this component.
  /// The method translates the current widget configuration and state into Flutter UI without mutating scheduler domain data.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'FocusFlow',
      debugShowCheckedModeBanner: false,
      theme: FocusFlowTheme.dark(),
      home: FocusFlowHome(composition: composition),
    );
  }
}
