<?php

use App\Modules\POS\Controllers\SaleController;
use Illuminate\Support\Facades\Route;

Route::middleware(['auth:sanctum', 'tenant', 'feature:pos'])->group(function (): void {
    Route::middleware('company.permission:pos.view')->group(function (): void {
        Route::get('/pos/sales', [SaleController::class, 'index']);
        Route::get('/pos/sales/{sale}/export/html', [SaleController::class, 'exportHtml']);
        Route::get('/pos/sales/{sale}', [SaleController::class, 'show']);
    });

    Route::middleware('company.permission:pos.manage')->group(function (): void {
        Route::post('/pos/sales', [SaleController::class, 'store']);
        Route::patch('/pos/sales/{sale}', [SaleController::class, 'update']);
    });
});
