<?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;
    protected $marketName;
    protected $gameType;
    protected $session;
    protected $number;

    public function __construct($amount, $fcm, $marketName, $gameType, $session, $number)
    {
        $this->amount = $amount;
        $this->fcm = $fcm;
        $this->marketName = $marketName;
        $this->gameType = $gameType;
        $this->session = $session;
        $this->number = $number;
    }

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


    public function toFcm()
    {
        if ($this->fcm == null) {
            return;
        }
        $title = "Congratulations🏆";
        $body = $this->amount."/- Rs. " . $this->marketName . " " . $this->gameType . " " . $this->session . "(".$this->number.")" . " Win Amount Added💰";
        NotificationController::sendNotificationToUser($this->fcm, $title, $body);
    }

    // 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);
    // }
}
