import { z } from "zod";
const uuid = z.string().uuid();
const expiresAtSchema = z.preprocess((value) => {
  if (value === void 0 || value === null || value === "") return null;
  const date = value instanceof Date ? value : new Date(String(value));
  return Number.isNaN(date.getTime()) ? void 0 : date;
}, z.date().nullable().refine((date) => date === null || date.getTime() > Date.now(), {
  message: "expiresAt must be in the future"
}));
const createApiKeySchema = z.object({
  name: z.string().min(1).max(120),
  description: z.string().max(1e3).optional().nullable(),
  tenantId: uuid.optional().nullable(),
  organizationId: uuid.optional().nullable(),
  roles: z.array(z.string().trim().min(1)).optional().default([]),
  expiresAt: expiresAtSchema.optional()
});
const updateApiKeySchema = createApiKeySchema.partial().extend({
  id: uuid
});
export {
  createApiKeySchema,
  updateApiKeySchema
};
//# sourceMappingURL=validators.js.map
