<?php

declare(strict_types=1);

use Illuminate\Support\Facades\Route;
use ImovelZapAi\ClientPortal\Presentation\Http\Controllers\Web\ClientPortalWebController;

Route::middleware([
    'auth',
    'tenant.resolve',
    'tenant.required',
    'tenant.active',
    'role:Admin|Gestor|Corretor',
])->prefix('portais')->name('client-portals.')->group(function (): void {
    Route::get('/', [ClientPortalWebController::class, 'index'])->name('index');
    Route::get('/novo', [ClientPortalWebController::class, 'create'])->name('create');
    Route::post('/', [ClientPortalWebController::class, 'store'])->name('store');
    Route::get('/{portal}', [ClientPortalWebController::class, 'show'])->name('show');
    Route::post('/{portal}/enviar', [ClientPortalWebController::class, 'send'])->name('send');
    Route::post('/{portal}/revogar', [ClientPortalWebController::class, 'revoke'])->name('revoke');
    Route::post('/documentos/{document}/aprovar', [ClientPortalWebController::class, 'approve'])->name('documents.approve');
    Route::post('/documentos/{document}/recusar', [ClientPortalWebController::class, 'reject'])->name('documents.reject');
});
