import { createCrudRoutes } from '../../utils/generic-crud.routes';
import { Card } from '../../modules/card/card.entity';
import { CardSchema, CreateCardDto, UpdateCardDto } from '../../modules/card/card.schema';
import { authMiddleware } from '../../middleware/auth.middleware';

const cardRoutes = createCrudRoutes({
  entity: Card,
  createSchema: CreateCardDto,
  updateSchema: UpdateCardDto,
  getSchema: CardSchema,
  listSchema: CardSchema,
  searchFields: ['card_no', 'card_type'],
  relations: ['agent'],
  middleware: [authMiddleware],
  userTracking: {
    createdByField: 'created_by',
    updatedByField: 'updated_by'
  }
});

export default cardRoutes;