import { createCrudRoutes } from '../../utils/generic-crud.routes';
import { OrderRefund } from '../../modules/orders/order-refund.entity';
import { OrderRefundSchema, CreateOrderRefundDto, UpdateOrderRefundDto } from '../../modules/orders/order-refund.schema';
import { authMiddleware } from '../../middleware/auth.middleware';

const orderRefundRoutes = createCrudRoutes({
  entity: OrderRefund,
  createSchema: CreateOrderRefundDto,
  updateSchema: UpdateOrderRefundDto,
  getSchema: OrderRefundSchema,
  listSchema: OrderRefundSchema,
  searchFields: ['orderNo', 'refundOrderNo'],
  relations: ['order'],
  middleware: [authMiddleware],
  userTracking: {
    createdByField: 'createdBy',
    updatedByField: 'updatedBy'
  }
});

export default orderRefundRoutes;