/* * 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"; /** * Preview of the balance impact for a time off request before it is created or updated. */ export type EmbeddedTimeOffRequestPreview = { /** * The employee's current available balance hours for this policy. Null for unlimited policies. */ balanceHours: string | null; /** * The total hours for this time off request. */ thisRequestHours: string; /** * Hours from other pending or approved requests for this policy. */ otherRequestedHours: string; /** * The projected balance after this request is applied. Null for unlimited policies. */ remainingBalanceHours: string | null; /** * Whether the time off policy allows a negative balance. */ allowNegativeBalance: boolean; /** * Whether the time off policy provides unlimited time off. */ unlimited: boolean; }; /** @internal */ export const EmbeddedTimeOffRequestPreview$inboundSchema: z.ZodType< EmbeddedTimeOffRequestPreview, z.ZodTypeDef, unknown > = z.object({ balance_hours: z.nullable(z.string()), this_request_hours: z.string(), other_requested_hours: z.string(), remaining_balance_hours: z.nullable(z.string()), allow_negative_balance: z.boolean(), unlimited: z.boolean(), }).transform((v) => { return remap$(v, { "balance_hours": "balanceHours", "this_request_hours": "thisRequestHours", "other_requested_hours": "otherRequestedHours", "remaining_balance_hours": "remainingBalanceHours", "allow_negative_balance": "allowNegativeBalance", }); }); export function embeddedTimeOffRequestPreviewFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EmbeddedTimeOffRequestPreview$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EmbeddedTimeOffRequestPreview' from JSON`, ); }