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

part of '../../task_actions.dart';

/// Result from applying a required task state transition.
class RequiredTaskActionResult {
  /// Creates a `RequiredTaskActionResult` instance with the values required by its invariants.
  /// Callers should pass already-normalized scheduler data because validation and defaulting belong at the model or service boundary, not in arbitrary UI code.
  RequiredTaskActionResult({
    required this.action,
    required this.task,
    required this.removedFromActivePlan,
    List<TaskActivity> activities = const <TaskActivity>[],
    this.transitionOutcomeCode,
  }) : activities = List<TaskActivity>.unmodifiable(activities);

  /// Action the user selected.
  final RequiredTaskAction action;

  /// Updated task after the transition.
  final Task task;

  /// Whether the transition removes the task from the active timeline.
  ///
  /// Critical missed tasks return true because they move to backlog. Cancelled
  /// and no-longer-relevant tasks also return true because they are no longer
  /// active planned work.
  final bool removedFromActivePlan;

  /// Internal activities produced by the transition.
  final List<TaskActivity> activities;

  /// Typed transition outcome.
  final TaskTransitionOutcomeCode? transitionOutcomeCode;
}
