<?php

namespace App\Mail;

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

class UserLoginCredentialsMail extends Mailable
{
    use Queueable, SerializesModels;

    public $email; // User's email
    public $password; // User's password
    public $name; // User's name
    public $siteName; // Site name from settings
    public $appUrl; // Application URL

    /**
     * Create a new message instance.
     *
     * @param string $email
     * @param string $password
     * @param string $name
     * @param string $siteName
     * @param string $appUrl
     */
    public function __construct($email, $password, $name, $siteName, $appUrl)
    {
        $this->email = $email;
        $this->password = $password;
        $this->name = $name;
        $this->siteName = $siteName;
        $this->appUrl = $appUrl;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->subject('Your Login Credentials - ' . $this->siteName)
                    ->view('emails.user_login_credentials')
                    ->with([
                        'email' => $this->email,
                        'password' => $this->password,
                        'name' => $this->name,
                        'siteName' => $this->siteName,
                        'appUrl' => $this->appUrl,
                    ]);
    }
}

