<?php

namespace App\Mail;

use Illuminate\Mail\Mailable;
use App\Models\Link;

class ThankMail extends Mailable
{
    public string $status;
    public Link $link;

    public function __construct(string $status, Link $link, string $url)
    {
        $this->status = $status;
        $this->link   = $link;
        $this->url   = $url;
    }

    public function build()
    {
        return $this
            ->from(config('mail.from.address'), config('mail.from.name'))
            ->to($this->link->donateur->email) 
            ->subject('FedaPay : ' . ucfirst($this->status))
            ->view('emails.thankmail')
            ->with([
                'status' => $this->status,
                'link'   => $this->link,
                'url'    => $this->url,
            ]);
    }
}