/**
 * Zod schemas for marketplace proxy endpoints.
 *
 * These validate query parameters before forwarding to platform-service.
 * The actual marketplace business logic lives in platform-service.
 */

import { z } from 'zod';

export const ListListingsQuerySchema = z.object({
  templateType: z.string().optional(),
  category: z.string().optional(),
  tags: z.string().optional(),
  pricingModel: z.string().optional(),
  minRating: z.coerce.number().min(0).max(5).optional(),
  sortBy: z.enum(['installCount', 'rating', 'newest', 'trending', 'createdAt']).default('createdAt'),
  sortOrder: z.enum(['asc', 'desc']).default('desc'),
  q: z.string().optional(),
  limit: z.coerce.number().min(1).max(100).default(20),
  offset: z.coerce.number().min(0).default(0),
});

export const ListInstallsQuerySchema = z.object({
  limit: z.coerce.number().min(1).max(100).default(20),
  offset: z.coerce.number().min(0).default(0),
});

export const ListReviewsQuerySchema = z.object({
  sortBy: z.enum(['newest', 'rating', 'helpful']).default('newest'),
  limit: z.coerce.number().min(1).max(100).default(20),
  offset: z.coerce.number().min(0).default(0),
});
