<?php

declare(strict_types=1);

use Illuminate\Support\Facades\Route;
use ImovelZapAi\Financial\Presentation\Http\Controllers\Web\FinancialWebController;

Route::middleware([
    'auth',
    'tenant.resolve',
    'tenant.required',
    'tenant.active',
    'role:Admin|Gestor|Corretor',
])->prefix('financeiro')->name('financial.')->group(function (): void {
    Route::get('/', [FinancialWebController::class, 'index'])->name('index');
    Route::get('/regras', [FinancialWebController::class, 'rules'])->name('rules.index');
    Route::post('/regras', [FinancialWebController::class, 'storeRule'])->name('rules.store');
    Route::get('/oportunidade/{dealId}', [FinancialWebController::class, 'show'])->name('show');
    Route::post('/oportunidade/{dealId}/iniciar', [FinancialWebController::class, 'storeBootstrap'])->name('bootstrap');
    Route::post('/oportunidade/{dealId}/pagamento', [FinancialWebController::class, 'storePayment'])->name('payment');
    Route::post('/oportunidade/{dealId}/repasse', [FinancialWebController::class, 'storeTransfer'])->name('transfer');
    Route::post('/repasse/{transferId}/concluir', [FinancialWebController::class, 'completeTransfer'])->name('transfer.complete');
});
