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

/// Implements Scheduling Engine behavior for the Scheduler Core package.
library;

// Scheduling engine for the ADHD scheduling starter project.
//
// This file is the core timeline manipulation layer. It takes task data plus a
// planning window and returns a new task list, notices, changes, and analysis
// findings. The implementation is deliberately side-effect free so a first-time
// reader can trace each operation from input validation, to placement planning,
// to application of the plan.
//
// Human reading map:
//   1. Data wrappers: `SchedulingWindow`, `SchedulingInput`, result classes.
//   2. Public engine methods: the operations UI/actions can call.
//   3. Private planning helpers: calculate intervals without changing tasks.
//   4. Private apply helpers: convert plans into updated tasks and notices.

import '../domain/models.dart';
import '../domain/occupancy_policy.dart';
import 'task_lifecycle.dart';
import '../domain/time_contracts.dart';
import '../logging/focus_flow_logger.dart';
part 'scheduling_engine/codes/notices/scheduling_notice_type.dart';
part 'scheduling_engine/codes/operations/scheduling_operation_code.dart';
part 'scheduling_engine/codes/operations/scheduling_outcome_code.dart';
part 'scheduling_engine/codes/notices/scheduling_issue_code.dart';
part 'scheduling_engine/codes/operations/scheduling_movement_code.dart';
part 'scheduling_engine/codes/conflicts/scheduling_conflict_code.dart';
part 'scheduling_engine/models/inputs/scheduling_window.dart';
part 'scheduling_engine/models/inputs/scheduling_input.dart';
part 'scheduling_engine/models/changes/scheduling_change.dart';
part 'scheduling_engine/models/changes/scheduling_overlap.dart';
part 'scheduling_engine/models/notices/scheduling_notice.dart';
part 'scheduling_engine/models/results/scheduling_result.dart';
part 'scheduling_engine/engine/scheduling_engine.dart';
part 'scheduling_engine/planning/placement_item.dart';
part 'scheduling_engine/planning/backlog_insertion_plan.dart';

/// Private file-level value for `_occupancyPolicy`.
/// Keeping this value near the helpers that use it avoids hidden global configuration while still preventing duplicate literals.
const OccupancyPolicy _occupancyPolicy = OccupancyPolicy();

/// Private file-level value for `_transitionService`.
/// Keeping this value near the helpers that use it avoids hidden global configuration while still preventing duplicate literals.
const TaskTransitionService _transitionService = TaskTransitionService();

/// Private file-level value for `_activityAccountingService`.
/// Keeping this value near the helpers that use it avoids hidden global configuration while still preventing duplicate literals.
const TaskActivityAccountingService _activityAccountingService =
    TaskActivityAccountingService();
