package com.iqser.red.service.persistence.management.v1.processor.service.download;

import java.util.Collection;

import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import com.iqser.red.service.persistence.management.v1.processor.service.FileManagementStorageService;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Service
@RequiredArgsConstructor
public class DownloadReportCleanupService {

    private final FileManagementStorageService fileManagementStorageService;


    @Async
    public void deleteTmpReportFiles(Collection<String> storageIds) {

        for (String storageId : storageIds) {
            fileManagementStorageService.deleteObject(storageId);
            log.info("Deleted tmp report file {}", storageId);
        }
    }

}
