using Microsoft.Extensions.DependencyInjection; namespace NfProcessorApp.Handlers { public class FileHandlerFactory(IServiceProvider provider) : IFileHandlerFactory { private readonly IServiceProvider _provider = provider; public IFileHandler CreateHandler(string filePath) { var ext = Path.GetExtension(filePath).ToLowerInvariant(); return ext switch { ".xml" => _provider.GetRequiredService(), ".pdf" => _provider.GetRequiredService(), _ => throw new NotSupportedException($"Extension not supported: {ext}") }; } } }