/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Unit of time for the look-back window. */ export const LookBackWindowDtoUnit = { Seconds: "seconds", Minutes: "minutes", Hours: "hours", Days: "days", Weeks: "weeks", Months: "months", } as const; /** * Unit of time for the look-back window. */ export type LookBackWindowDtoUnit = ClosedEnum; export type LookBackWindowDto = { /** * Amount of time for the look-back window. */ amount: number; /** * Unit of time for the look-back window. */ unit: LookBackWindowDtoUnit; }; /** @internal */ export const LookBackWindowDtoUnit$inboundSchema: z.ZodNativeEnum< typeof LookBackWindowDtoUnit > = z.nativeEnum(LookBackWindowDtoUnit); /** @internal */ export const LookBackWindowDtoUnit$outboundSchema: z.ZodNativeEnum< typeof LookBackWindowDtoUnit > = LookBackWindowDtoUnit$inboundSchema; /** @internal */ export const LookBackWindowDto$inboundSchema: z.ZodType< LookBackWindowDto, z.ZodTypeDef, unknown > = z.object({ amount: z.number(), unit: LookBackWindowDtoUnit$inboundSchema, }); /** @internal */ export type LookBackWindowDto$Outbound = { amount: number; unit: string; }; /** @internal */ export const LookBackWindowDto$outboundSchema: z.ZodType< LookBackWindowDto$Outbound, z.ZodTypeDef, LookBackWindowDto > = z.object({ amount: z.number(), unit: LookBackWindowDtoUnit$outboundSchema, }); export function lookBackWindowDtoToJSON( lookBackWindowDto: LookBackWindowDto, ): string { return JSON.stringify( LookBackWindowDto$outboundSchema.parse(lookBackWindowDto), ); } export function lookBackWindowDtoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LookBackWindowDto$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LookBackWindowDto' from JSON`, ); }