<?php
namespace Claromentis\Core\Audit\Controller;

$GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"] = (@$GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"] ?: array()) + array();
use Claromentis\Core\Audit\AuditFilesystem;
use Claromentis\Core\Audit\Exception\ArchiveFileException;
use Claromentis\Core\Http\ResponseFactory;
use Symfony\Component\HttpFoundation\Response;




class ArchiveFileController
{
    
    
    
    
    private $response_factory;
    
    
    
    
    private $audit_filesystem;
    public function __construct(AuditFilesystem $audit_filesystem, ResponseFactory $response_factory)
    {
        $this->audit_filesystem = $audit_filesystem;
        $this->response_factory = $response_factory;
    }
    
    
    
    
    
    
    
    public function DownloadArchiveFile(string $file_name) : Response
    {
        try {
            $_fff0d0f440a71cff94e24364c98f3118 = $this->audit_filesystem->ReadArchiveFile($file_name);
            return $this->response_factory->GetFileResponse($_fff0d0f440a71cff94e24364c98f3118->getFilename(), $_fff0d0f440a71cff94e24364c98f3118->getRealPath(), true);
        } catch (ArchiveFileException $_c35473364fa7a050299058f332ec29c1) {
            return $this->response_factory->GetJsonPrettyResponse($_c35473364fa7a050299058f332ec29c1->getMessage(), 400);
        }
    }
}