<?php

namespace App\Livewire\Projects\Tabs;

use App\Jobs\ProjectMosiacGeneratorJob;
use App\Models\Project;
use App\Models\ProjectMosaic;
use App\ProjectLogger;
use Carbon\Carbon;
use Illuminate\Support\Facades\Response;
use Livewire\Component;
use Livewire\WithPagination;

class Logs extends Component
{
    use WithPagination;

    public Project $project;


    public function download($file_name) {
        return Response::download(ProjectLogger::getAsList($this->project)->where('name', $file_name)->first()->path);
    }

    public function render()
    {
        $logs = ProjectLogger::getAsList($this->project);

        return view('livewire.projects.tabs.logs', [
            'logs' => $logs,
        ]);
    }
}
