#nullable disable
namespace InsiteCommerce.Web.Helpers
{
    using Insite.Core.Providers;
    using Microsoft.Extensions.Hosting;

#pragma warning disable CS0618
    public class DefaultDebugModeProvider : IDebugModeProvider
#pragma warning restore CS0618
    {
        public bool IsDebugEnabled => this.IsPreprocessorDebugEnabled;

        private bool IsPreprocessorDebugEnabled { get; }

        public DefaultDebugModeProvider()
        {
#if DEBUG
            this.IsPreprocessorDebugEnabled = true;
#endif
        }
    }

    public class WebHostEnvironment : IHostEnvironment
    {
        // in net8, this works based on ASPNETCORE_ENVIRONMENT=Development
        // for net48, this allows partners to control it based on release vs debug
        public bool IsDevelopment()
        {
#if DEBUG
            return true;
#else
            return false;
#endif
        }
    }
}
