<?php

namespace App\Modules\Network\Commands;

use App\Events\SimplePrivateEvent;
use App\Helpers\ClickhouseHandler;
use App\Modules\Network\Models\Goliath\GoliathRegion;
use App\Modules\Network\Models\Goliath\GoliathSubregion;
use App\Modules\Network\Models\Goliath\GoliathMetro;
use Carbon\Carbon;

class NetworkDev extends \App\Console\Commands\BaseCommand
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'network:dev';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Runs the playground development script for debugging and testing.';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        $chh = new ClickhouseHandler(
            'default',
            null,
            null,
            null,
            null,
            'https://akvorado.gsl.tools/clickhouse/'
        );

        $x = $chh->selectUnpaged("SELECT DISTINCT SrcAddr FROM flows WHERE TimeReceived >= parseDateTimeBestEffortOrNull('2024-04-02T13:31:30.827Z') AND TimeReceived <= parseDateTimeBestEffortOrNull('2024-04-02T13:36:18.076Z') AND InIfBoundary = 'external' AND SrcPort = 53 AND DstAS = 212477")->get();

        echo json_encode($x);
    
        return 0;
    }
}