<?php

use Illuminate\Support\Facades\Route;
use Modules\Dashboard\Http\Controllers\DashboardController;
use Modules\Dashboard\Http\Controllers\KJC\KJCDashboardController;
use Modules\Dashboard\Http\Controllers\PKJ\PKJDashboardController;

Route::middleware(['auth:sanctum', 'single.session'])->prefix('v1')->group(function () {
    // Main dashboard endpoints
    Route::get('/dashboard/stat-cards', [DashboardController::class, 'getStatCards']);
    Route::get('/dashboard/overview', [DashboardController::class, 'getOverview']);
    
    // KJC specific endpoints
    Route::prefix('dashboard/kjc')->group(function () {
        // Pie charts
        Route::get('/entitlement-vs-holdings-pie', [KJCDashboardController::class, 'getEntitlementVsHoldingsPieChart']);
        Route::get('/holdings-status-breakdown-pie', [KJCDashboardController::class, 'getHoldingsStatusBreakdownPieChart']);
        
        // Bar charts
        Route::get('/historical-metrics-bar', [KJCDashboardController::class, 'getHistoricalMetricsBarChart']);

        // Other charts
        Route::get('/unit-performance-chart', [KJCDashboardController::class, 'getUnitPerformanceChart']);
        Route::get('/monthly-trends-chart', [KJCDashboardController::class, 'getMonthlyTrendsChart']);
        
        // Drill-down endpoints
        Route::get('/drill-down/entitlement-vs-holdings', [KJCDashboardController::class, 'getEntitlementVsHoldingsDetails']);
        Route::get('/drill-down/holdings-status', [KJCDashboardController::class, 'getHoldingsStatusDetails']);
        Route::get('/status/{status}/details', [KJCDashboardController::class, 'getAssetDetailsByStatus']);
    });
    
    // PKJ specific endpoints
    Route::prefix('dashboard/pkj')->group(function () {
        Route::get('/entitlement-vs-holdings-pie', [PKJDashboardController::class, 'getEntitlementVsHoldingsPieChart']);
        Route::get('/holdings-status-breakdown-pie', [PKJDashboardController::class, 'getHoldingsStatusBreakdownPieChart']);
        Route::get('/monthly-trends', [PKJDashboardController::class, 'getMonthlyTrendsChart']);
        Route::get('/holdings-by-category-bar', [PKJDashboardController::class, 'getHoldingsByCategoryBarChart']);
        
        // Drill-down endpoints
        Route::get('/category/{categoryId}/metrics-bar', [PKJDashboardController::class, 'getCategoryMetricsBarChart']);
        Route::get('/category/{categoryId}/status-breakdown-pie', [PKJDashboardController::class, 'getCategoryStatusBreakdownPieChart']);
        Route::get('/category/{categoryId}/status/{status}/details', [PKJDashboardController::class, 'getAssetDetailsByCategoryAndStatus']);
    });
});