import { createCrudRoutes } from '@/server/utils/generic-crud.routes';
import { PaymentEntity } from '@/server/modules/payments/payment.entity';
import { PaymentSchema, CreatePaymentDto, UpdatePaymentDto } from '@/server/modules/payments/payment.schema';
import { authMiddleware } from '@/server/middleware/auth.middleware';

const paymentRoutes = createCrudRoutes({
  entity: PaymentEntity,
  createSchema: CreatePaymentDto,
  updateSchema: UpdatePaymentDto,
  getSchema: PaymentSchema,
  listSchema: PaymentSchema,
  searchFields: ['orderNo', 'description', 'transactionId'],
  relations: ['user'],
  middleware: [authMiddleware]
});

export default paymentRoutes;