<?php

namespace App\Notifications;

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

class GameResultNotification extends Notification
{
    use Queueable;

    protected $userFcms = [];
    protected $market;
    protected $result;
    protected $type;

    public function __construct($market, $result, $userFcms, $type = 'general_notifications')
    {
        $this->market = $market;
        $this->userFcms = $userFcms;
        $this->result = $result;
        $this->type = $type;
    }

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


    public function toFcm()
    {

        $title = "Game Results";
        // $body = "$this->market result is $this->result.";
        $body = "$this->market $this->result.";
        // NotificationController::sendNotificationToTopic($this->type, $title, $body);
        NotificationController::sendNotificationToTopic($this->type, Null, $body);
    }
}
