import { createCrudRoutes } from '../../utils/generic-crud.routes';
import { Merchant } from '../../modules/merchant/merchant.entity';
import { MerchantSchema, CreateMerchantDto, UpdateMerchantDto } from '../../modules/merchant/merchant.schema';
import { authMiddleware } from '../../middleware/auth.middleware';

const merchantRoutes = createCrudRoutes({
  entity: Merchant,
  createSchema: CreateMerchantDto,
  updateSchema: UpdateMerchantDto,
  getSchema: MerchantSchema,
  listSchema: MerchantSchema,
  searchFields: ['name', 'username', 'realname', 'phone'],
  middleware: [authMiddleware],
  userTracking: {
    createdByField: 'createdBy',
    updatedByField: 'updatedBy'
  }
});

export default merchantRoutes;