using MangaReader.Core.HttpService;
using MangaReader.Core.Metadata;
using MangaReader.Core.Search;
using MangaReader.Core.Sources.MangaDex.Api;
using MangaReader.Core.Sources.MangaDex.Metadata;
using MangaReader.Core.Sources.MangaDex.Search;
using MangaReader.Core.Sources.NatoManga.Api;
using MangaReader.Core.Sources.NatoManga.Metadata;
using MangaReader.Core.Sources.NatoManga.Search;

#pragma warning disable IDE0130 // Namespace does not match folder structure
namespace Microsoft.Extensions.DependencyInjection;
#pragma warning restore IDE0130 // Namespace does not match folder structure

public static class ServiceCollectionExtensions
{
    public static IServiceCollection AddMangaReader(this IServiceCollection services)
    {
        // Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:139.0) Gecko/20100101 Firefox/139.0
        services.AddHttpClient<IHttpService, HttpService>(client =>
        {
            client.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:139.0) Gecko/20100101 Firefox/139.0");
        });

        services.AddScoped<IHttpService, HttpService>();

        //services.AddScoped<INatoMangaClient, NatoMangaClient>();
        services.AddScoped<IMangaDexClient, MangaDexClient>();

        //services.AddScoped<IMangaSearchProvider, NatoMangaSearchProvider>();
        services.AddScoped<IMangaSearchProvider, MangaDexSearchProvider>();
        services.AddScoped<IMangaSearchCoordinator, MangaSearchCoordinator>();

        //services.AddScoped<IMangaMetadataProvider, NatoMangaWebCrawler>();
        services.AddScoped<IMangaMetadataProvider, MangaDexMetadataProvider>();

        return services;
    }
}