import { Router } from 'express';
import * as customerController from '../controllers/customer.controller.js';
import * as bankLookupController from '../controllers/bankLookup.controller.js';
import { authenticate, requirePermission } from '../middleware/auth.js';

const router = Router();

// IBAN-Prüfung + BIC/Bank-Nachschlag (offline, Bundesbank-BLZ). Liefert nur
// öffentliche Bankverzeichnis-Daten – reicht daher ein eingeloggter Nutzer.
router.post('/iban-lookup', authenticate, bankLookupController.lookupIban);

router.put('/:id', authenticate, requirePermission('customers:update'), customerController.updateBankCard);
router.delete('/:id', authenticate, requirePermission('customers:delete'), customerController.deleteBankCard);

export default router;
