<?php

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

// contas do proprio prestador autenticado (o provider nunca vem da URL)
Route::get('/provider/bank-accounts',                 [ProviderBankAccountController::class, 'index'])->middleware('permission:config.provider,view');
Route::post('/provider/bank-accounts',                [ProviderBankAccountController::class, 'store'])->middleware('permission:config.provider,edit');
// a troca da conta principal acontece na propria edicao da conta (campo is_primary)
Route::put('/provider/bank-accounts/{id}',            [ProviderBankAccountController::class, 'update'])->middleware('permission:config.provider,edit');
Route::delete('/provider/bank-accounts/{id}',         [ProviderBankAccountController::class, 'destroy'])->middleware('permission:config.provider,edit');

// leitura pelo backoffice (admin nao altera dados bancarios)
Route::get('/provider/{id}/bank-accounts',            [ProviderBankAccountController::class, 'forProvider'])->middleware('permission:config.provider,view');
