<?php

namespace App\Console\Commands\Broadcast;

use App\Console\Commands\BaseCommand;
use App\Events\SimplePrivateEvent;
use App\Events\SimplePublicEvent;
use Illuminate\Support\Facades\Redis;

class BroadcastMapRates extends BaseCommand
{

    protected $signature = 'broadcast:map-rates';

    protected $description = 'Broadcasts map information.';

    protected $notEnterprise = true;

    public function handle()
    {

        /*if(config('app.demonstration') || 1) {

            SimplePrivateEvent::dispatch('standard', "weathermap", json_decode(file_get_contents(app_path('Demonstration/WeathermapDemo.json')), true));
            SimplePublicEvent::dispatch('standard', "weathermap", json_decode(file_get_contents(app_path('Demonstration/WeathermapDemo.json')), true));

            return 0;
        }*/

        SimplePrivateEvent::dispatch('standard', "weathermap", json_decode(Redis::get('websockets-weathermap-standard'), true));
        SimplePublicEvent::dispatch('standard', "weathermap", json_decode(Redis::get('websockets-weathermap-public'), true));
    
        return 0;
    }
}