public static class ServiceCollectionExtensions
{
    public static PeAnalysisBuilder AddPeAnalysis(this IServiceCollection services, Action<PeAnalysisOptions>? configure = null)
    {
        services.AddMemoryCache();
        services.AddOptions<PeAnalysisOptions>();
        if (configure is not null)
        {
            services.Configure(configure);
        }

        services.AddSingleton<ContentHasher>();
        services.AddSingleton<IPeCacheService, PeCacheService>();

        services.AddSingleton<DosHeaderParser>();
        services.AddSingleton<NtHeadersParser>();
        services.AddSingleton<SectionHeaderParser>();
        services.AddSingleton<ImportDirectoryParser>();
        services.AddSingleton<ExportDirectoryParser>();
        services.AddSingleton<ResourceDirectoryParser>();
        services.AddSingleton<RelocationDirectoryParser>();
        services.AddSingleton<DebugDirectoryParser>();
        services.AddSingleton<TlsDirectoryParser>();
        services.AddSingleton<LoadConfigDirectoryParser>();
        services.AddSingleton<DelayImportDirectoryParser>();
        services.AddSingleton<BoundImportDirectoryParser>();
        services.AddSingleton<ExceptionDirectoryParser>();
        services.AddSingleton<CertificateDirectoryParser>();
        services.AddSingleton<ComDescriptorParser>();
        services.AddSingleton<IPeParser, PeParser>();

        services.AddSingleton<IPeValidator, PeValidator>();
        services.AddSingleton<IValidationRule, HeaderConsistencyRule>();
        services.AddSingleton<IValidationRule, SectionAlignmentRule>();
        services.AddSingleton<IValidationRule, EntryPointValidityRule>();
        services.AddSingleton<IValidationRule, RvaBoundsRule>();
        services.AddSingleton<IValidationRule, OverlappingSectionsRule>();
        services.AddSingleton<IValidationRule, SuspiciousFlagsRule>();
        services.AddSingleton<IValidationRule, ImportExportIntegrityRule>();

        services.AddSingleton<IDisassembler, X86Disassembler>();
        services.AddSingleton<IDisassembler, X64Disassembler>();

        services.AddSingleton<IPeAnalyzer, AntiDebugAnalyzer>();
        services.AddSingleton<IPeAnalyzer, ShellcodeAnalyzer>();
        services.AddSingleton<IPeAnalyzer, PackerAnalyzer>();

        services.AddSingleton<PeAnalysisOrchestrator>();
        services.AddSingleton<IPeAnalysisService, PeAnalysisService>();

        return new PeAnalysisBuilder(services);
    }

    public static IServiceCollection AddPeAnalysisCoreOnly(this IServiceCollection services)
    {
        services.AddPeAnalysis();
        return services;
    }
}