<?php

namespace App\Notifications;

use App\Http\Controllers\Dashboard\NotificationController;
use App\Models\AppData;
use GuzzleHttp\Client;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;

class BonusWonNotification extends Notification
{
    use Queueable;
    protected $amount;
    protected $fcm;

    /**
     * Create a new notification instance.
     */
    public function __construct($amount, $fcm)
    {
        $this->amount = $amount;
        $this->fcm = $fcm;
    }

    public function via()
    {
        return $this->toFcm();
    }

    public function toFcm()
    {
        if ($this->fcm == null) {
            return;
        }

        $title = "Bonus Won";
        $body = "Congratulations. Your Won. ₹" . $this->amount . " in Bonus.";
        NotificationController::sendNotificationToUser($this->fcm, $title, $body);
    }
}
