<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;

class CoursePurchaseCreated extends Notification
{
    use Queueable;

    protected $payment;
    protected $courses;

    public function __construct($payment, $courses)
    {
        $this->payment = $payment;
        $this->courses = $courses;
    }

    public function via(object $notifiable): array
    {
        return ['mail'];
    }

    public function toMail(object $notifiable): MailMessage
    {
        return (new MailMessage)
            ->subject(get_phrase('Course Purchase Created') . ' - ' . config('app.name'))
            ->view('vendor.notifications.course_purchased_created', [
                'user'    => $notifiable,
                'payment' => $this->payment,
                'courses' => $this->courses,
            ]);
    }
}
