/* * 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 { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Benefit, Benefit$inboundSchema } from "./benefit.js"; import { Deduction, Deduction$inboundSchema } from "./deduction.js"; import { Tax, Tax$inboundSchema } from "./tax.js"; export type Compensation = { /** * A unique identifier for an object. */ employeeId: string | null; /** * The employee's net pay. Only available when payroll has been processed */ netPay?: number | null | undefined; /** * The employee's gross pay. Only available when payroll has been processed */ grossPay?: number | null | undefined; /** * An array of employer and employee taxes for the pay period. */ taxes?: Array | null | undefined; /** * An array of employee deductions for the pay period. */ deductions?: Array | null | undefined; /** * An array of employee benefits for the pay period. */ benefits?: Array | null | undefined; }; /** @internal */ export const Compensation$inboundSchema: z.ZodType< Compensation, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ employee_id: types.nullable(types.string()), net_pay: z.nullable(types.number()).optional(), gross_pay: z.nullable(types.number()).optional(), taxes: z.nullable(z.array(Tax$inboundSchema)).optional(), deductions: z.nullable(z.array(Deduction$inboundSchema)).optional(), benefits: z.nullable(z.array(Benefit$inboundSchema)).optional(), }).transform((v) => { return remap$(v, { "employee_id": "employeeId", "net_pay": "netPay", "gross_pay": "grossPay", }); }) ); export function compensationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Compensation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Compensation' from JSON`, ); }