import { z } from 'zod';

export const baseListQuerySchema = z.object({
  page: z.coerce.number().int().min(1).default(1),
  // Bumped from 100 to 1000 so the table page-size selector can offer
  // an "All" option that maps to a single big fetch. Above 1000 the
  // caller must paginate; anything routinely north of that ceiling
  // needs virtualization rather than a bigger page-size cap.
  limit: z.coerce.number().int().min(1).max(1000).default(25),
  sort: z.string().optional(),
  order: z.enum(['asc', 'desc']).default('desc'),
  search: z.string().optional(),
  includeArchived: z
    .enum(['true', 'false'])
    .default('false')
    .transform((v) => v === 'true'),
});

export type BaseListQuery = z.infer<typeof baseListQuerySchema>;
