using SharepointToolbox.Core.Models;
using SharepointToolbox.Services;
using Xunit;

namespace SharepointToolbox.Tests.Services;

public class StorageServiceTests
{
    [Fact(Skip = "Requires live CSOM context — covered by Plan 03-02 implementation")]
    public Task CollectStorageAsync_ReturnsLibraryNodes_ForDocumentLibraries()
        => Task.CompletedTask;

    [Fact(Skip = "Requires live CSOM context — covered by Plan 03-02 implementation")]
    public Task CollectStorageAsync_WithFolderDepth1_ReturnsSubfolderNodes()
        => Task.CompletedTask;

    [Fact]
    public void StorageNode_VersionSizeBytes_IsNonNegative()
    {
        // VersionSizeBytes = TotalSizeBytes - FileStreamSizeBytes (never negative)
        var node = new StorageNode { TotalSizeBytes = 1000L, FileStreamSizeBytes = 1200L };
        Assert.Equal(0L, node.VersionSizeBytes); // Math.Max(0, -200) = 0
    }

    [Fact]
    public void StorageNode_VersionSizeBytes_IsCorrectWhenPositive()
    {
        var node = new StorageNode { TotalSizeBytes = 5000L, FileStreamSizeBytes = 3000L };
        Assert.Equal(2000L, node.VersionSizeBytes);
    }

    [Fact]
    public void StorageNode_DefaultKind_IsLibrary()
    {
        var node = new StorageNode();
        Assert.Equal(StorageNodeKind.Library, node.Kind);
    }

    [Fact]
    public void StorageScanOptions_DefaultIncludeFlags_AreAllTrue()
    {
        var opts = new StorageScanOptions();
        Assert.True(opts.IncludeHiddenLibraries);
        Assert.True(opts.IncludePreservationHold);
        Assert.True(opts.IncludeListAttachments);
        Assert.True(opts.IncludeRecycleBin);
    }
}
