/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; 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"; /** * Type of the time off activity */ export const TimeOffType = { Vacation: "vacation", Sick: "sick", } as const; /** * Type of the time off activity */ export type TimeOffType = ClosedEnum; /** * Representation of a Time Off Activity */ export type TimeOffActivity = { /** * unique identifier of a time off policy */ policyUuid?: string | null | undefined; /** * Type of the time off activity */ timeOffType?: TimeOffType | undefined; /** * The name of the time off policy for this activity */ policyName?: string | null | undefined; /** * The type of the time off event/activity */ eventType?: string | undefined; /** * A description for the time off event/activity */ eventDescription?: string | null | undefined; /** * The datetime of the time off activity */ effectiveTime?: string | null | undefined; /** * The time off balance at the time of the activity */ balance?: string | null | undefined; /** * The amount the time off balance changed as a result of the activity */ balanceChange?: string | null | undefined; }; /** @internal */ export const TimeOffType$inboundSchema: z.ZodNativeEnum = z .nativeEnum(TimeOffType); /** @internal */ export const TimeOffActivity$inboundSchema: z.ZodType< TimeOffActivity, z.ZodTypeDef, unknown > = z.object({ policy_uuid: z.nullable(z.string()).optional(), time_off_type: TimeOffType$inboundSchema.optional(), policy_name: z.nullable(z.string()).optional(), event_type: z.string().optional(), event_description: z.nullable(z.string()).optional(), effective_time: z.nullable(z.string()).optional(), balance: z.nullable(z.string()).optional(), balance_change: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "policy_uuid": "policyUuid", "time_off_type": "timeOffType", "policy_name": "policyName", "event_type": "eventType", "event_description": "eventDescription", "effective_time": "effectiveTime", "balance_change": "balanceChange", }); }); export function timeOffActivityFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TimeOffActivity$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TimeOffActivity' from JSON`, ); }