/* * 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"; import { PaymentMethodBankAccount, PaymentMethodBankAccount$inboundSchema, } from "./paymentmethodbankaccount.js"; /** * The payment method type. If type is Check, then `split_by` and `splits` do not need to be populated. If type is Direct Deposit, `split_by` and `splits` are required. */ export const EmployeePaymentMethodType = { DirectDeposit: "Direct Deposit", Check: "Check", } as const; /** * The payment method type. If type is Check, then `split_by` and `splits` do not need to be populated. If type is Direct Deposit, `split_by` and `splits` are required. */ export type EmployeePaymentMethodType = ClosedEnum< typeof EmployeePaymentMethodType >; export const EmployeePaymentMethodSplitBy = { Amount: "Amount", Percentage: "Percentage", } as const; export type EmployeePaymentMethodSplitBy = ClosedEnum< typeof EmployeePaymentMethodSplitBy >; export type EmployeePaymentMethod = { /** * The current version of the object. See the [versioning guide](https://docs.gusto.com/embedded-payroll/docs/idempotency) for information on how to use this field. */ version?: string | undefined; /** * The payment method type. If type is Check, then `split_by` and `splits` do not need to be populated. If type is Direct Deposit, `split_by` and `splits` are required. */ type?: EmployeePaymentMethodType | undefined; /** * Describes how the payment will be split. If `split_by` is Percentage, then the split amounts must add up to exactly 100. If `split_by` is Amount, then the last split `amount` must be `null` to capture the remainder. */ splitBy?: EmployeePaymentMethodSplitBy | null | undefined; splits?: Array | null | undefined; }; /** @internal */ export const EmployeePaymentMethodType$inboundSchema: z.ZodNativeEnum< typeof EmployeePaymentMethodType > = z.nativeEnum(EmployeePaymentMethodType); /** @internal */ export const EmployeePaymentMethodSplitBy$inboundSchema: z.ZodNativeEnum< typeof EmployeePaymentMethodSplitBy > = z.nativeEnum(EmployeePaymentMethodSplitBy); /** @internal */ export const EmployeePaymentMethod$inboundSchema: z.ZodType< EmployeePaymentMethod, z.ZodTypeDef, unknown > = z.object({ version: z.string().optional(), type: EmployeePaymentMethodType$inboundSchema.optional(), split_by: z.nullable(EmployeePaymentMethodSplitBy$inboundSchema).optional(), splits: z.nullable(z.array(PaymentMethodBankAccount$inboundSchema)) .optional(), }).transform((v) => { return remap$(v, { "split_by": "splitBy", }); }); export function employeePaymentMethodFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EmployeePaymentMethod$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EmployeePaymentMethod' from JSON`, ); }