import { z } from "zod";

import { parseCsv } from "../../utils/http.js";

export const timelineQuerySchema = z.object({
  from: z.string().optional(),
  to: z.string().optional(),
  categoryIds: z.preprocess(parseCsv, z.array(z.string().uuid()).default([])),
  status: z.enum(["all", "active", "service", "retired"]).optional(),
  search: z.string().optional(),
  customerName: z.string().optional(),
  includeInactive: z
    .union([z.boolean(), z.string()])
    .optional()
    .transform((value) => value === true || value === "true")
});
