/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; 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"; import { Benefit, Benefit$inboundSchema, Benefit$Outbound, Benefit$outboundSchema, } from "./benefit.js"; import { Deduction, Deduction$inboundSchema, Deduction$Outbound, Deduction$outboundSchema, } from "./deduction.js"; import { Tax, Tax$inboundSchema, Tax$Outbound, Tax$outboundSchema, } 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 > = z.object({ employee_id: z.nullable(z.string()), net_pay: z.nullable(z.number()).optional(), gross_pay: z.nullable(z.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", }); }); /** @internal */ export type Compensation$Outbound = { employee_id: string | null; net_pay?: number | null | undefined; gross_pay?: number | null | undefined; taxes?: Array | null | undefined; deductions?: Array | null | undefined; benefits?: Array | null | undefined; }; /** @internal */ export const Compensation$outboundSchema: z.ZodType< Compensation$Outbound, z.ZodTypeDef, Compensation > = z.object({ employeeId: z.nullable(z.string()), netPay: z.nullable(z.number()).optional(), grossPay: z.nullable(z.number()).optional(), taxes: z.nullable(z.array(Tax$outboundSchema)).optional(), deductions: z.nullable(z.array(Deduction$outboundSchema)).optional(), benefits: z.nullable(z.array(Benefit$outboundSchema)).optional(), }).transform((v) => { return remap$(v, { employeeId: "employee_id", netPay: "net_pay", grossPay: "gross_pay", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Compensation$ { /** @deprecated use `Compensation$inboundSchema` instead. */ export const inboundSchema = Compensation$inboundSchema; /** @deprecated use `Compensation$outboundSchema` instead. */ export const outboundSchema = Compensation$outboundSchema; /** @deprecated use `Compensation$Outbound` instead. */ export type Outbound = Compensation$Outbound; } export function compensationToJSON(compensation: Compensation): string { return JSON.stringify(Compensation$outboundSchema.parse(compensation)); } export function compensationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Compensation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Compensation' from JSON`, ); }