/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: a48816eab10f */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { TimeInterval, TimeInterval$inboundSchema, TimeInterval$Outbound, TimeInterval$outboundSchema, } from "./timeinterval.js"; /** * The nature of the event, for example "out of office". */ export const AnonymousEventEventType = { Default: "DEFAULT", OutOfOffice: "OUT_OF_OFFICE", } as const; /** * The nature of the event, for example "out of office". */ export type AnonymousEventEventType = OpenEnum; /** * A generic, light-weight calendar event. */ export type AnonymousEvent = { time?: TimeInterval | undefined; /** * The nature of the event, for example "out of office". */ eventType?: AnonymousEventEventType | undefined; }; /** @internal */ export const AnonymousEventEventType$inboundSchema: z.ZodType< AnonymousEventEventType, z.ZodTypeDef, unknown > = openEnums.inboundSchema(AnonymousEventEventType); /** @internal */ export const AnonymousEventEventType$outboundSchema: z.ZodType< string, z.ZodTypeDef, AnonymousEventEventType > = openEnums.outboundSchema(AnonymousEventEventType); /** @internal */ export const AnonymousEvent$inboundSchema: z.ZodType< AnonymousEvent, z.ZodTypeDef, unknown > = z.object({ time: TimeInterval$inboundSchema.optional(), eventType: AnonymousEventEventType$inboundSchema.optional(), }); /** @internal */ export type AnonymousEvent$Outbound = { time?: TimeInterval$Outbound | undefined; eventType?: string | undefined; }; /** @internal */ export const AnonymousEvent$outboundSchema: z.ZodType< AnonymousEvent$Outbound, z.ZodTypeDef, AnonymousEvent > = z.object({ time: TimeInterval$outboundSchema.optional(), eventType: AnonymousEventEventType$outboundSchema.optional(), }); export function anonymousEventToJSON(anonymousEvent: AnonymousEvent): string { return JSON.stringify(AnonymousEvent$outboundSchema.parse(anonymousEvent)); } export function anonymousEventFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AnonymousEvent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AnonymousEvent' from JSON`, ); }