<?php

namespace App\Mail;

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

class ForgotPasswordMail extends Mailable
{
    use Queueable, SerializesModels;

    public $resetLink;
    public $appResetLink;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct($resetLink, $token = null, $email = null)
    {
        $this->resetLink = $resetLink;

        // Buat URL untuk mobile app (deep link)
        if ($token && $email) {
            $this->appResetLink = "kidgo://reset-password?token=$token&email=$email";
        } else {
            $this->appResetLink = null;
        }
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->subject('Reset Password KidGo App')
            ->view('emails.forgot-password');
    }
}
