<?php

use Illuminate\Support\Facades\Route;
use App\Modules\Finance\Controllers\UtilityFeeController;
use App\Modules\Finance\Controllers\AccountingReportController;

Route::middleware('auth')->group(function () {
    // 公共事業費管理
    Route::middleware('permission:utility_fees.view')->group(function () {
        Route::get('/utility-fees', [UtilityFeeController::class, 'index'])->name('utility-fees.index');
    });
    Route::middleware('permission:utility_fees.create')->group(function () {
        Route::post('/utility-fees', [UtilityFeeController::class, 'store'])->name('utility-fees.store');
    });
    Route::middleware('permission:utility_fees.edit')->group(function () {
        Route::put('/utility-fees/{utility_fee}', [UtilityFeeController::class, 'update'])->name('utility-fees.update');
    });
    Route::middleware('permission:utility_fees.delete')->group(function () {
        Route::delete('/utility-fees/{utility_fee}', [UtilityFeeController::class, 'destroy'])->name('utility-fees.destroy');
    });

    // 會計報表
    Route::middleware('permission:accounting.view')->prefix('accounting-report')->group(function () {
        Route::get('/', [AccountingReportController::class, 'index'])->name('accounting.report');
        Route::get('/export', [AccountingReportController::class, 'export'])
            ->middleware('permission:accounting.export')
            ->name('accounting.export');
    });
});
