/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 826d0c446e55 */ import * as z from "zod/v4"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ScheduleRange, ScheduleRange$inboundSchema, ScheduleRange$Outbound, ScheduleRange$outboundSchema, } from "./schedulerange.js"; export type ScheduleCalendar = { second?: Array | undefined; minute?: Array | undefined; hour?: Array | undefined; dayOfMonth?: Array | undefined; month?: Array | undefined; year?: Array | undefined; dayOfWeek?: Array | undefined; comment?: string | null | undefined; }; /** @internal */ export const ScheduleCalendar$inboundSchema: z.ZodType< ScheduleCalendar, unknown > = z.object({ second: z.array(ScheduleRange$inboundSchema).optional(), minute: z.array(ScheduleRange$inboundSchema).optional(), hour: z.array(ScheduleRange$inboundSchema).optional(), day_of_month: z.array(ScheduleRange$inboundSchema).optional(), month: z.array(ScheduleRange$inboundSchema).optional(), year: z.array(ScheduleRange$inboundSchema).optional(), day_of_week: z.array(ScheduleRange$inboundSchema).optional(), comment: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "day_of_month": "dayOfMonth", "day_of_week": "dayOfWeek", }); }); /** @internal */ export type ScheduleCalendar$Outbound = { second?: Array | undefined; minute?: Array | undefined; hour?: Array | undefined; day_of_month?: Array | undefined; month?: Array | undefined; year?: Array | undefined; day_of_week?: Array | undefined; comment?: string | null | undefined; }; /** @internal */ export const ScheduleCalendar$outboundSchema: z.ZodType< ScheduleCalendar$Outbound, ScheduleCalendar > = z.object({ second: z.array(ScheduleRange$outboundSchema).optional(), minute: z.array(ScheduleRange$outboundSchema).optional(), hour: z.array(ScheduleRange$outboundSchema).optional(), dayOfMonth: z.array(ScheduleRange$outboundSchema).optional(), month: z.array(ScheduleRange$outboundSchema).optional(), year: z.array(ScheduleRange$outboundSchema).optional(), dayOfWeek: z.array(ScheduleRange$outboundSchema).optional(), comment: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { dayOfMonth: "day_of_month", dayOfWeek: "day_of_week", }); }); export function scheduleCalendarToJSON( scheduleCalendar: ScheduleCalendar, ): string { return JSON.stringify( ScheduleCalendar$outboundSchema.parse(scheduleCalendar), ); } export function scheduleCalendarFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ScheduleCalendar$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ScheduleCalendar' from JSON`, ); }