using AbrBlazorTools;
using ApiUtils;
using Blazored.LocalStorage;
using BlazorPages.Tools;
using CurrieTechnologies.Razor.SweetAlert2;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BlazorPages
{
    public static class Dependency
    {
        public static void Inject(this IServiceCollection Services, bool isMobileApp = false)
        {
            Statics.IsFromMobileApp = isMobileApp;
            #region Tools
            ///libs:
            Services.AddBlazoredLocalStorage(config => config.JsonSerializerOptions.WriteIndented = true);
            Services.AddSweetAlert2();
            ////////
            Services.AddScoped<ILoadingSpinner, LoadingSpinner>();
            Services.AddScoped<IBrowserTools, BrowserTools>();
            Services.AddScoped<IHttpClientWithLoginToken, HttpClientWithLoginToken>();
            Services.AddScoped<ISwalUtils, SwalUtils>();
            #endregion

            #region API
            Services.AddScoped<IUserUtils, UserUtils>();        

            #endregion

            Services.AddScoped(sp => new HttpClient());



        }
    }
}
