<?php

namespace AuthStack\Driver\AUDGeneric\App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

class PasswordTokenSent extends Mailable
{
    use Queueable, SerializesModels;

    /**
     * @var array
     */
    protected $attributes;

    /**
     * @var string
     */
    protected $link;

    /**
     * Create a new message instance.
     *
     * @param array $attributes
     * @param string $link
     */
    public function __construct(array $attributes, string $link)
    {
        $this->attributes = $attributes;
        $this->link = $link;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->from(env('MAIL_FROM_ADDRESS'))
            ->view('aud::password.sent')
            ->with([
                'attributes' => $this->attributes,
                'link' => $this->link
            ]);
    }
}
