import express from 'express';
const router = express.Router();
import * as dealerController from './dealer.controller.js';
import * as bankController from './bank.controller.js';
import { authenticate } from '../../common/middleware/auth.js';

router.use(authenticate as any);

router.get('/dashboard', dealerController.getDealerDashboard);
router.get('/', dealerController.getDealers);
router.post('/', dealerController.createDealer);
router.get('/application/:applicationId', dealerController.getDealerByApplicationId);
router.put('/:id', dealerController.updateDealer);

// Bank Details
router.get('/:dealerId/bank-details', bankController.getBankDetailsByDealerId);
router.post('/:dealerId/bank-details', bankController.upsertBankDetail);
router.delete('/bank-details/:id', bankController.deleteBankDetail);

export default router;
