<?php

use App\Http\Controllers\FixedAssetController;
use App\Http\Controllers\FixedAssetReportController;
use Illuminate\Support\Facades\Route;

Route::middleware(['auth','module:fixed_assets'])->group(function (): void {
    Route::get('/fixed-assets', [FixedAssetController::class, 'index'])->middleware('permission:fixed-assets.view')->name('fixed-assets.index');
    Route::get('/fixed-assets/create', [FixedAssetController::class, 'create'])->middleware('permission:fixed-assets.manage')->name('fixed-assets.create');
    Route::post('/fixed-assets', [FixedAssetController::class, 'store'])->middleware('permission:fixed-assets.manage')->name('fixed-assets.store');
    Route::get('/fixed-assets/reports', [FixedAssetReportController::class, 'index'])->middleware('permission:fixed-assets.reports.view')->name('fixed-assets.reports');
    Route::get('/fixed-assets/reports/export.csv', [FixedAssetReportController::class, 'export'])->middleware('permission:fixed-assets.reports.export')->name('fixed-assets.reports.export');
    Route::get('/fixed-assets/{fixedAsset}', [FixedAssetController::class, 'show'])->middleware(['permission:fixed-assets.view','can:view,fixedAsset'])->name('fixed-assets.show');
    Route::put('/fixed-assets/{fixedAsset}', [FixedAssetController::class, 'update'])->middleware(['permission:fixed-assets.manage','can:manage,fixedAsset'])->name('fixed-assets.update');
    Route::post('/fixed-assets/{fixedAsset}/depreciation', [FixedAssetController::class, 'depreciate'])->middleware(['permission:fixed-assets.depreciate','can:depreciate,fixedAsset'])->name('fixed-assets.depreciate');
    Route::post('/fixed-assets/{fixedAsset}/maintenance', [FixedAssetController::class, 'maintenance'])->middleware(['permission:fixed-assets.maintenance','can:maintenance,fixedAsset'])->name('fixed-assets.maintenance');
});
