using FluentAssertions;
using TeleBot.Models;
using Xunit;

namespace TeleBot.Tests.Models
{
    public class PrivacySettingsTests
    {
        [Fact]
        public void NewPrivacySettings_ShouldHaveSecureDefaults()
        {
            // Arrange & Act
            var settings = new PrivacySettings();

            // Assert
            settings.UseEphemeralMode.Should().BeTrue("Ephemeral mode should be enabled by default for privacy");
            settings.DisableAnalytics.Should().BeTrue("Analytics should be disabled by default for privacy");
            settings.EnableDisappearingMessages.Should().BeTrue("Disappearing messages should be enabled by default");
            settings.UseTorOnly.Should().BeFalse("Tor is optional");
            settings.RequirePGP.Should().BeFalse("PGP is optional");
            settings.DisappearingMessageTTL.Should().Be(30, "Default TTL should be 30 seconds");
        }

        [Fact]
        public void PrivacySettings_CanToggleEphemeralMode()
        {
            // Arrange
            var settings = new PrivacySettings();

            // Act
            settings.UseEphemeralMode = false;

            // Assert
            settings.UseEphemeralMode.Should().BeFalse();
        }

        [Fact]
        public void PrivacySettings_CanEnableTor()
        {
            // Arrange
            var settings = new PrivacySettings();

            // Act
            settings.UseTorOnly = true;

            // Assert
            settings.UseTorOnly.Should().BeTrue();
        }

        [Fact]
        public void PrivacySettings_CanSetPGPKey()
        {
            // Arrange
            var settings = new PrivacySettings();
            var pgpKey = "-----BEGIN PGP PUBLIC KEY BLOCK-----\ntest key\n-----END PGP PUBLIC KEY BLOCK-----";

            // Act
            settings.RequirePGP = true;
            settings.PGPPublicKey = pgpKey;

            // Assert
            settings.RequirePGP.Should().BeTrue();
            settings.PGPPublicKey.Should().Be(pgpKey);
        }

        [Fact]
        public void PrivacySettings_CanDisableAnalytics()
        {
            // Arrange
            var settings = new PrivacySettings();

            // Act
            settings.DisableAnalytics = false;

            // Assert
            settings.DisableAnalytics.Should().BeFalse();
        }

        [Fact]
        public void PrivacySettings_CanSetDisappearingMessageTTL()
        {
            // Arrange
            var settings = new PrivacySettings();

            // Act
            settings.DisappearingMessageTTL = 60;

            // Assert
            settings.DisappearingMessageTTL.Should().Be(60);
        }

        [Fact]
        public void PrivacySettings_MaxPrivacy_Configuration()
        {
            // Arrange
            var settings = new PrivacySettings
            {
                UseEphemeralMode = true,
                UseTorOnly = true,
                RequirePGP = true,
                DisableAnalytics = true,
                EnableDisappearingMessages = true,
                DisappearingMessageTTL = 10,
                PGPPublicKey = "test-key"
            };

            // Assert - All privacy features should be enabled
            settings.UseEphemeralMode.Should().BeTrue();
            settings.UseTorOnly.Should().BeTrue();
            settings.RequirePGP.Should().BeTrue();
            settings.DisableAnalytics.Should().BeTrue();
            settings.EnableDisappearingMessages.Should().BeTrue();
            settings.DisappearingMessageTTL.Should().Be(10);
            settings.PGPPublicKey.Should().NotBeNullOrEmpty();
        }
    }
}