namespace BankSampahApp.Services;

/// <summary>
/// Interface untuk centralized configuration management
/// </summary>
public interface IAppConfigurationService
{
    /// <summary>
    /// Gets application configuration with fallback
    /// </summary>
    /// <typeparam name="T">Type of configuration value</typeparam>
    /// <param name="key">Configuration key</param>
    /// <param name="defaultValue">Default value if key not found</param>
    /// <returns>Configuration value or default</returns>
    T GetValue<T>(string key, T defaultValue);

    /// <summary>
    /// Gets application name from configuration
    /// </summary>
    string ApplicationName { get; }

    /// <summary>
    /// Gets whether detailed exceptions should be shown
    /// </summary>
    bool ShowDetailedExceptions { get; }

    /// <summary>
    /// Gets cache configuration settings
    /// </summary>
    CacheSettings CacheSettings { get; }

    /// <summary>
    /// Gets statistics configuration settings
    /// </summary>
    StatisticsSettings StatisticsSettings { get; }

    /// <summary>
    /// Gets development configuration settings
    /// </summary>
    DevelopmentSettings DevelopmentSettings { get; }
}

/// <summary>
/// Cache configuration settings
/// </summary>
public class CacheSettings
{
    public TimeSpan FeaturesExpiration { get; set; } = TimeSpan.FromHours(1);
    public TimeSpan StatisticsExpiration { get; set; } = TimeSpan.FromMinutes(30);
    public TimeSpan StatisticsSlidingExpiration { get; set; } = TimeSpan.FromMinutes(5);
    public TimeSpan PrivacyPageExpiration { get; set; } = TimeSpan.FromHours(1);
}

/// <summary>
/// Statistics configuration settings
/// </summary>
public class StatisticsSettings
{
    public int BaseUsers { get; set; } = 1000;
    public decimal BaseWaste { get; set; } = 15.0m;
    public int BaseRewards { get; set; } = 890;
    public decimal BaseEnvironmentImpact { get; set; } = 95.0m;
    public double GrowthFactorMultiplier { get; set; } = 0.001;
    public double MaxGrowthFactor { get; set; } = 1.5;
}

/// <summary>
/// Development configuration settings
/// </summary>
public class DevelopmentSettings
{
    public bool DetailedExceptions { get; set; } = false;
    public bool EnablePerformanceMetrics { get; set; } = false;
    public int SimulatedDelayMs { get; set; } = 0;
}