import { createCrudRoutes } from '../../utils/generic-crud.routes';
import { UserCardBalanceRecord } from '../../modules/user-card-balance-records/user-card-balance-record.entity';
import { UserCardBalanceRecordSchema, CreateUserCardBalanceRecordDto, UpdateUserCardBalanceRecordDto } from '../../modules/user-card-balance-records/user-card-balance-record.schema';
import { authMiddleware } from '../../middleware/auth.middleware';

const userCardBalanceRecordRoutes = createCrudRoutes({
  entity: UserCardBalanceRecord,
  createSchema: CreateUserCardBalanceRecordDto,
  updateSchema: UpdateUserCardBalanceRecordDto,
  getSchema: UserCardBalanceRecordSchema,
  listSchema: UserCardBalanceRecordSchema,
  searchFields: ['cardNo', 'orderNo', 'remark'],
  relations: ['user', 'userCard'],
  middleware: [authMiddleware],
  userTracking: {
    createdByField: 'createdBy',
    updatedByField: 'updatedBy'
  }
});

export default userCardBalanceRecordRoutes;