<?php

namespace App\Filament\Pages;

use Filament\Pages\Page;

class ExecutiveDashboard extends Page
{
    protected static ?string $navigationIcon = 'heroicon-o-chart-bar';

    protected static string $view = 'filament.pages.executive-dashboard';

    protected static ?string $title = 'Executive Dashboard';

    protected static ?string $navigationLabel = 'Executive Dashboard';

    protected static ?string $navigationGroup = 'Dashboard';

    protected static ?int $navigationSort = 1;

    protected static ?string $description = 'Dashboard strategis untuk pimpinan - overview metrics dan trends';

    public function getHeaderWidgets(): array
    {
        return [
            \App\Filament\Widgets\Executive\ExecutiveStatsWidget::class,
        ];
    }

    public function getFooterWidgets(): array
    {
        return [
            \App\Filament\Widgets\Executive\AttendanceTrendWidget::class,
            \App\Filament\Widgets\Executive\EmployeePerformanceWidget::class,
            \App\Filament\Widgets\Executive\DepartmentStatsWidget::class,
        ];
    }

    public function getHeaderWidgetsColumns(): int|array
    {
        return 1;
    }

    public function getFooterWidgetsColumns(): int|array
    {
        return [
            'md' => 2,
            'xl' => 3,
        ];
    }

    public static function shouldRegisterNavigation(): bool
    {
        // Hanya tampil untuk super_admin atau admin dengan role tertentu
        $user = auth()->user();
        return $user && ($user->hasRole('super_admin') || $user->hasRole('admin'));
    }
}
