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

part of '../application_recovery.dart';

/// Result returned by app-open recovery.
class AppOpenRecoveryResult {
  /// Creates a `AppOpenRecoveryResult` 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.
  AppOpenRecoveryResult({
    required this.outcome,
    required this.sourceDate,
    required this.targetDate,
    required this.snapshot,
    required List<Task> changedTasks,
    required List<TaskActivity> activities,
    required List<SchedulingNotice> notices,
    required List<SchedulingChange> changes,
  })  : changedTasks = List<Task>.unmodifiable(changedTasks),
        activities = List<TaskActivity>.unmodifiable(activities),
        notices = List<SchedulingNotice>.unmodifiable(notices),
        changes = List<SchedulingChange>.unmodifiable(changes);

  /// High-level deterministic outcome.
  final AppOpenRecoveryOutcome outcome;

  /// Owner-local source day that was checked.
  final CivilDate sourceDate;

  /// Owner-local target day used for placement and notice surfacing.
  final CivilDate targetDate;

  /// Persisted deterministic source-date snapshot.
  final SchedulingStateSnapshot snapshot;

  /// Tasks changed by this operation.
  final List<Task> changedTasks;

  /// Movement activities persisted with changed tasks.
  final List<TaskActivity> activities;

  /// Notices returned to the caller.
  final List<SchedulingNotice> notices;

  /// Machine-readable movement records.
  final List<SchedulingChange> changes;
}
