using LightlessSync.FileCache;
using LightlessSync.LightlessConfiguration;
using LightlessSync.Services.Mediator;
using LightlessSync.Services.TextureCompression;
using LightlessSync.WebAPI.Files;
using Microsoft.Extensions.Logging;

namespace LightlessSync.PlayerData.Factories;

public class FileDownloadManagerFactory
{
    private readonly ILoggerFactory _loggerFactory;
    private readonly LightlessMediator _lightlessMediator;
    private readonly FileTransferOrchestrator _fileTransferOrchestrator;
    private readonly FileCacheManager _fileCacheManager;
    private readonly FileCompactor _fileCompactor;
    private readonly LightlessConfigService _configService;
    private readonly TextureDownscaleService _textureDownscaleService;
    private readonly TextureMetadataHelper _textureMetadataHelper;

    public FileDownloadManagerFactory(
        ILoggerFactory loggerFactory,
        LightlessMediator lightlessMediator,
        FileTransferOrchestrator fileTransferOrchestrator,
        FileCacheManager fileCacheManager,
        FileCompactor fileCompactor,
        LightlessConfigService configService,
        TextureDownscaleService textureDownscaleService,
        TextureMetadataHelper textureMetadataHelper)
    {
        _loggerFactory = loggerFactory;
        _lightlessMediator = lightlessMediator;
        _fileTransferOrchestrator = fileTransferOrchestrator;
        _fileCacheManager = fileCacheManager;
        _fileCompactor = fileCompactor;
        _configService = configService;
        _textureDownscaleService = textureDownscaleService;
        _textureMetadataHelper = textureMetadataHelper;
    }

    public FileDownloadManager Create()
    {
        return new FileDownloadManager(
            _loggerFactory.CreateLogger<FileDownloadManager>(),
            _lightlessMediator,
            _fileTransferOrchestrator,
            _fileCacheManager,
            _fileCompactor,
            _configService,
            _textureDownscaleService,
            _textureMetadataHelper);
    }
}
