// Copyright (c) 2026 Duplicati Inc. All rights reserved. using Duplicati.Library.Common.IO; using Duplicati.Library.Interface; using System.Runtime.CompilerServices; namespace Duplicati.Proprietary.GoogleWorkspace.SourceItems; internal class DriveSourceEntry(SourceProvider provider, string parentPath, string userId) : MetaEntryBase(Util.AppendDirSeparator(SystemIO.IO_OS.PathCombine(parentPath, "Drive")), null, null) { public override async IAsyncEnumerable Enumerate([EnumeratorCancellation] CancellationToken cancellationToken) { if (cancellationToken.IsCancellationRequested) yield break; yield return new DriveFolderSourceEntry(provider, this.Path, userId, "My Drive", "root"); if (cancellationToken.IsCancellationRequested) yield break; yield return new SharedDrivesSourceEntry(provider, this.Path, userId); } public override Task> GetMinorMetadata(CancellationToken cancellationToken) { return Task.FromResult(new Dictionary { { "gsuite:v", "1" }, { "gsuite:Type", SourceItemType.Drive.ToString() }, { "gsuite:Name", "Drive" }, { "gsuite:Id", "Drive" } } .Where(kv => !string.IsNullOrEmpty(kv.Value)) .ToDictionary(kv => kv.Key, kv => kv.Value)); } }