/* * 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 { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type Balances = { /** * The UUID of the time off policy. */ policyUuid?: string | undefined; /** * The employee's current available balance hours for this policy. */ balanceHours?: string | undefined; /** * The total hours accrued year-to-date for this policy. */ accruedHours?: string | undefined; /** * The total hours used year-to-date for this policy. */ usedHours?: string | undefined; /** * The total hours from pending time off requests for this policy. */ pendingHours?: string | null | undefined; }; /** * Time off balance for an employee, grouped by policy. */ export type EmbeddedTimeOffBalance = { /** * The UUID of the employee. */ employeeUuid?: string | undefined; /** * The employee's time off balances, one entry per policy. */ balances?: Array | undefined; }; /** @internal */ export const Balances$inboundSchema: z.ZodType< Balances, z.ZodTypeDef, unknown > = z.object({ policy_uuid: z.string().optional(), balance_hours: z.string().optional(), accrued_hours: z.string().optional(), used_hours: z.string().optional(), pending_hours: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "policy_uuid": "policyUuid", "balance_hours": "balanceHours", "accrued_hours": "accruedHours", "used_hours": "usedHours", "pending_hours": "pendingHours", }); }); export function balancesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Balances$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Balances' from JSON`, ); } /** @internal */ export const EmbeddedTimeOffBalance$inboundSchema: z.ZodType< EmbeddedTimeOffBalance, z.ZodTypeDef, unknown > = z.object({ employee_uuid: z.string().optional(), balances: z.array(z.lazy(() => Balances$inboundSchema)).optional(), }).transform((v) => { return remap$(v, { "employee_uuid": "employeeUuid", }); }); export function embeddedTimeOffBalanceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EmbeddedTimeOffBalance$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EmbeddedTimeOffBalance' from JSON`, ); }