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

namespace SharepointToolbox.Tests.Services;

public class BulkMemberServiceTests
{
    [Fact]
    public void BulkMemberService_Implements_IBulkMemberService()
    {
        // GraphClientFactory requires MsalClientFactory which requires real MSAL setup
        // Verify the type hierarchy at minimum
        Assert.True(typeof(IBulkMemberService).IsAssignableFrom(typeof(BulkMemberService)));
    }

    [Fact]
    public void BulkMemberRow_DefaultValues()
    {
        var row = new BulkMemberRow();
        Assert.Equal(string.Empty, row.Email);
        Assert.Equal(string.Empty, row.GroupName);
        Assert.Equal(string.Empty, row.GroupUrl);
        Assert.Equal(string.Empty, row.Role);
    }

    [Fact]
    public void BulkMemberRow_PropertiesSettable()
    {
        var row = new BulkMemberRow
        {
            Email = "user@test.com",
            GroupName = "Marketing",
            GroupUrl = "https://contoso.sharepoint.com/sites/Marketing",
            Role = "Owner"
        };

        Assert.Equal("user@test.com", row.Email);
        Assert.Equal("Marketing", row.GroupName);
        Assert.Equal("Owner", row.Role);
    }

    [Fact(Skip = "Requires live SharePoint tenant and Graph permissions")]
    public async Task AddMembersAsync_ValidRows_AddsToGroups()
    {
    }

    [Fact(Skip = "Requires live SharePoint tenant")]
    public async Task AddMembersAsync_InvalidEmail_ReportsPerItemError()
    {
    }

    [Fact(Skip = "Requires Graph permissions - Group.ReadWrite.All")]
    public async Task AddMembersAsync_M365Group_UsesGraphApi()
    {
    }
}
