<?php

namespace App\Controllers;

use App\Services\DashboardService;

class Dashboard extends BaseController
{
    public function index()
    {
        $dashboard = new DashboardService();
        $summary   = $dashboard->summary();

        return view('dashboard/index', array_merge($this->baseViewData(), [
            'title'              => 'Dashboard',
            'operationalDate'    => strtoupper(date('l, F j, Y')),
            'timezoneLabel'      => 'UTC' . date('P'),
            'summary'            => $summary,
            'kpis'               => $dashboard->kpis(),
            'chartData'          => $dashboard->chartData(),
            'defaultChartPeriod' => $dashboard->defaultChartPeriod(),
            'loadCharts'         => true,
        ]));
    }
}
