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

part of '../../document_mapping.dart';

/// Convenience extension for converting a [Task] into a V1 document map.
extension TaskDocumentExtension on Task {
  /// Converts scheduler data for `toDocument` without changing the source object.
  /// Conversion helpers keep persistence and export shapes explicit so domain models do not depend on storage-specific details.
  Map<String, Object?> toDocument({
    required String ownerId,
    int revision = 1,
    bool clearSchedule = false,
    DateTime? backlogEnteredAt,
    String? backlogEnteredAtProvenance,
  }) {
    return TaskDocumentMapping.toDocument(
      this,
      ownerId: ownerId,
      revision: revision,
      clearSchedule: clearSchedule,
      backlogEnteredAt: backlogEnteredAt,
      backlogEnteredAtProvenance: backlogEnteredAtProvenance,
    );
  }
}
