import { Router } from 'express';
import { AddressController } from '../controllers/address.controller';
import { validateRequest } from '../middleware/validation.middleware';
import { addressParamSchema } from '../../application/dto';

/**
 * Address routes mounted under `/api/v1`.
 *
 * Routes:
 *  - GET /addresses/:address  Get an address record by its blockchain address.
 *                               Params: { address: string }
 *                               Response: { id, address, type, walletId }
 */
export const createAddressRoutes = (controller: AddressController): Router => {
  const router = Router();

  router.get(
    '/addresses/:address',
    validateRequest({ params: addressParamSchema }),
    controller.getByAddress,
  );

  return router;
};
