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

part of '../../../scheduling_engine.dart';

/// Exact placement change made by a scheduling operation.
///
/// Changes are machine-readable before/after records. UI can use notices for
/// display text, but persistence, undo, analytics, or tests should inspect these
/// fields to know exactly which task moved and where.
class SchedulingChange {
  /// Creates a `SchedulingChange` 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.
  const SchedulingChange({
    required this.taskId,
    required this.previousStart,
    required this.previousEnd,
    required this.nextStart,
    required this.nextEnd,
  });

  /// Task that moved or had its schedule cleared.
  final String taskId;

  /// Previous scheduled start, or null if the task was previously unplaced.
  final DateTime? previousStart;

  /// Previous scheduled end, or null if the task was previously unplaced.
  final DateTime? previousEnd;

  /// New scheduled start, or null if the task was moved out of the timeline.
  final DateTime? nextStart;

  /// New scheduled end, or null if the task was moved out of the timeline.
  final DateTime? nextEnd;
}
