<?php

use App\Http\Controllers\CashClosingController;
use Illuminate\Support\Facades\Route;

Route::middleware('auth')->group(function (): void {
    Route::get('/cash-closing', [CashClosingController::class, 'index'])
        ->middleware('permission:cash-closing.view')->name('cash-closing.index');
    Route::post('/cash-closing/reconciliations', [CashClosingController::class, 'reconcile'])
        ->middleware('permission:cash-reconciliation.perform')->name('cash-closing.reconcile');
    Route::post('/cash-closing/prepare', [CashClosingController::class, 'prepare'])
        ->middleware('permission:daily-closing.prepare')->name('cash-closing.prepare');
    Route::get('/cash-closing/{dailyClosing}', [CashClosingController::class, 'show'])
        ->middleware(['permission:cash-closing.view','can:view,dailyClosing'])->name('cash-closing.show');
    Route::post('/cash-closing/{dailyClosing}/confirm', [CashClosingController::class, 'confirm'])
        ->middleware(['permission:daily-closing.confirm','can:confirm,dailyClosing'])->name('cash-closing.confirm');
});
