import { createCrudRoutes } from '../../utils/generic-crud.routes';
import { UserCard } from '../../modules/user-cards/user-card.entity';
import { UserCardSchema, CreateUserCardDto, UpdateUserCardDto } from '../../modules/user-cards/user-card.schema';
import { authMiddleware } from '../../middleware/auth.middleware';

const userCardRoutes = createCrudRoutes({
  entity: UserCard,
  createSchema: CreateUserCardDto,
  updateSchema: UpdateUserCardDto,
  getSchema: UserCardSchema,
  listSchema: UserCardSchema,
  searchFields: ['cardNo', 'sjtCardNo'],
  relations: ['user', 'agent'],
  middleware: [authMiddleware],
  userTracking: {
    createdByField: 'createdBy',
    updatedByField: 'updatedBy'
  }
});

export default userCardRoutes;