<?php

namespace App\Mail;

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

class PaymentReminderEmail extends Mailable
{
    use Queueable, SerializesModels;

    protected $emailSubject;
    protected $message;
    protected $order;

    public $data;

    /**
     * Erstellt eine neue PaymentReminderEmail Instanz
     *
     * @param string $subject
     * @param string $message
     * @param object|null $user
     * @param object|null $order
     * @param float|null $paymentAmount
     * @param string|null $dueDate
     * @param string|null $paymentUrl
     */
    public function __construct($subject, $message, $order = null)
    {
        $this->emailSubject = $subject;
        $this->message = $message;
        $this->order = $order;
    }

    /**
     * Baut die E-Mail
     *
     * @return $this
     */
    public function build()
    {
        


        $paymentUrl = route('user_myorder_detail', ['id' => $this->order->id]);
        $buttonText = __('email.my_orders') ?: 'Meine Bestellungen';

        return $this->subject($this->emailSubject)
                    ->view('emails.payment_reminder')
                    ->with([
                        'content' => $this->message,
                        'url' => $paymentUrl,
                        'button' => $buttonText,
                    ]);
    }
} 