<?php

namespace App\Controllers;

use App\Core\View;
use App\Services\DashboardService;

final class DashboardController
{


  private DashboardService $dashboardService;
  private View $view;
  public function __construct()
  {
    $this->view = new View();
    $this->dashboardService = new DashboardService();
  }

  public function index(): void
  {

    $this->view->renderAdminPage("dashboard/index", []);
  }

  public function sla()
  {

    $period = $_GET['periode'] ?? 'month';
    $this->view->renderAdminPage("dashboard/sla", [
      "summary" => $this->dashboardService->getSlaSummary($period),
      "tickets" => $this->dashboardService->getActiveTicket($period)
    ]);
  }
}
