<?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\Notification;
use Illuminate\Support\Facades\Log;

class GameWinNotification extends Notification
{
    use Queueable;

    protected $amount;
    protected $fcm;

    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 = "Game Win";
        $body = "You won game and amount is ₹" . $this->amount;
        NotificationController::sendNotificationToUser($this->fcm, $title, $body);
    }
}
