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

part of '../free_slots.dart';

/// Result from explicitly scheduling a required visible commitment.
class RequiredCommitmentScheduleResult {
  /// Creates a `RequiredCommitmentScheduleResult` 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.
  RequiredCommitmentScheduleResult({
    required this.status,
    required this.schedulingResult,
    required List<ProtectedFreeSlotConflict> protectedFreeSlotConflicts,
  }) : protectedFreeSlotConflicts =
            List<ProtectedFreeSlotConflict>.unmodifiable(
          protectedFreeSlotConflicts,
        );

  /// High-level typed outcome.
  final RequiredCommitmentScheduleStatus status;

  /// Replacement task list, notices, changes, and overlap details.
  final SchedulingResult schedulingResult;

  /// Protected rest interruptions caused by the explicit placement.
  final List<ProtectedFreeSlotConflict> protectedFreeSlotConflicts;

  /// Whether this placement interrupted protected rest.
  bool get hasProtectedFreeSlotConflict {
    return protectedFreeSlotConflicts.isNotEmpty;
  }
}
