<?php

namespace App\Mail;

use App\Models\Project;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;

class ScheduledReportMail extends Mailable implements ShouldQueue
{
    use Queueable, SerializesModels;

    public function __construct(
        public Project $project,
        public User $user,
        public array $reportData,
        public \App\DTO\ReportFilters $filters
    ) {}

    public function envelope(): Envelope
    {
        return new Envelope(
            subject: "Informe programado: {$this->project->name}",
        );
    }

    public function content(): Content
    {
        return new Content(
            view: 'emails.scheduled-report',
            with: [
                'project' => $this->project,
                'user' => $this->user,
                'data' => $this->reportData,
                'filters' => $this->filters,
            ],
        );
    }
}