using GmRelay.Shared.Features.Sessions.ExportCalendar;
using GmRelay.Shared.Platform;

namespace GmRelay.Bot.Tests.Features.Sessions.ExportCalendar;

public sealed class ExportCalendarCommandContractTests
{
    [Fact]
    public void ExportCalendarCommand_ShouldExposePlatformNeutralContext()
    {
        AssertProperty<ExportCalendarCommand>("Group", typeof(PlatformGroup));
        AssertProperty<ExportCalendarCommand>("User", typeof(PlatformUser));
        AssertNoTelegramSpecificProperties<ExportCalendarCommand>();
    }

    private static void AssertProperty<T>(string name, Type expectedType)
    {
        var property = Assert.Single(typeof(T).GetProperties(), p => p.Name == name);
        Assert.Equal(expectedType, property.PropertyType);
    }

    private static void AssertNoTelegramSpecificProperties<T>()
    {
        var names = typeof(T).GetProperties().Select(p => p.Name).ToArray();
        Assert.DoesNotContain(names, name => name.Contains("Telegram", StringComparison.Ordinal));
        Assert.DoesNotContain("ChatId", names);
        Assert.DoesNotContain("MessageId", names);
        Assert.DoesNotContain("TelegramUserId", names);
        Assert.DoesNotContain("TelegramUsername", names);
    }
}
