import { z } from "zod";

export const statsQuerySchema = z
  .object({
    from: z.string().optional(),
    to: z.string().optional()
  })
  .refine(
    (value) => {
      if (!value.from || !value.to) {
        return true;
      }

      return value.from <= value.to;
    },
    {
      message: "`from` must be less than or equal to `to`",
      path: ["to"]
    }
  );

export const userClicksBodySchema = z.object({
  count: z.coerce.number().int().min(1).max(500).default(1)
});
