<?php

namespace App\Notifications;

use App\Models\PayoutRequest;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Laravel\Nova\Notifications\NovaChannel;
use Laravel\Nova\Notifications\NovaNotification;

class PayoutRequestCreated extends Notification
{
    use Queueable;

    private PayoutRequest $request;

    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct(PayoutRequest $payoutRequest)
    {
        $this->request = $payoutRequest;
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param mixed $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['mail', NovaChannel::class];
    }

    /**
     * Get the mail representation of the notification.
     *
     * @param mixed $notifiable
     * @return MailMessage
     */
    public function toMail($notifiable)
    {
        return (new MailMessage)->subject("New Payout request")
            ->line('New payout requests waiting for your consideration.')
            ->action('View', url('/admin/resources/payout-requests'));
    }


    public function toNova()
    {
        return (new NovaNotification)
            ->message('New payout requests waiting for your consideration')->
            action('View', url('/admin/resources/payout-requests'));
    }
}
