<?php

namespace App\Mail;

use App\Models\Dictionaries\DictionaryItem;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

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

    public array $data;

    public function __construct(array $data) {
        $this->data = $data;
    }

    public function build() {
        $dictionary = DictionaryItem::byUuid($this->data['feedback-type'])->first();
        $this->data['feedback-type'] = $dictionary->title;
        return $this->subject('Поступило обращение с сайта')->view('mail.feedback.support');
    }
}
