/* * 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 { ClosedEnum } from "../../types/enums.js"; import { GarnishmentChildSupport, GarnishmentChildSupport$Outbound, GarnishmentChildSupport$outboundSchema, } from "./garnishmentchildsupport.js"; export const GarnishmentRequestGarnishmentType = { ChildSupport: "child_support", FederalTaxLien: "federal_tax_lien", StateTaxLien: "state_tax_lien", StudentLoan: "student_loan", CreditorGarnishment: "creditor_garnishment", FederalLoan: "federal_loan", OtherGarnishment: "other_garnishment", } as const; export type GarnishmentRequestGarnishmentType = ClosedEnum< typeof GarnishmentRequestGarnishmentType >; /** * Request body for creating a garnishment. */ export type GarnishmentRequest = { /** * Whether or not this garnishment is currently active. */ active?: boolean | undefined; /** * The amount of the garnishment. Either a percentage or a fixed dollar amount. Represented as a float, e.g. "8.00". */ amount: string; /** * The description of the garnishment. */ description?: string | undefined; /** * Whether the garnishment is court ordered. */ courtOrdered: boolean; /** * The specific type of garnishment for court ordered garnishments. */ garnishmentType?: GarnishmentRequestGarnishmentType | null | undefined; /** * The number of times to apply the garnishment. Ignored if recurring is true. */ times?: number | null | undefined; /** * Whether the garnishment should recur indefinitely. */ recurring?: boolean | undefined; /** * The maximum deduction per annum. A null value indicates no maximum. Represented as a float, e.g. "200.00". */ annualMaximum?: string | null | undefined; /** * The maximum deduction per pay period. A null value indicates no maximum. Represented as a float, e.g. "16.00". */ payPeriodMaximum?: string | null | undefined; /** * Whether the amount should be treated as a percentage to be deducted per pay period. */ deductAsPercentage?: boolean | undefined; /** * A maximum total deduction for the lifetime of this garnishment. A null value indicates no maximum. */ totalAmount?: string | null | undefined; /** * Additional child support order details */ childSupport?: GarnishmentChildSupport | null | undefined; }; /** @internal */ export const GarnishmentRequestGarnishmentType$outboundSchema: z.ZodNativeEnum< typeof GarnishmentRequestGarnishmentType > = z.nativeEnum(GarnishmentRequestGarnishmentType); /** @internal */ export type GarnishmentRequest$Outbound = { active: boolean; amount: string; description?: string | undefined; court_ordered: boolean; garnishment_type?: string | null | undefined; times: number | null; recurring: boolean; annual_maximum: string | null; pay_period_maximum: string | null; deduct_as_percentage: boolean; total_amount?: string | null | undefined; child_support?: GarnishmentChildSupport$Outbound | null | undefined; }; /** @internal */ export const GarnishmentRequest$outboundSchema: z.ZodType< GarnishmentRequest$Outbound, z.ZodTypeDef, GarnishmentRequest > = z.object({ active: z.boolean().default(true), amount: z.string(), description: z.string().optional(), courtOrdered: z.boolean(), garnishmentType: z.nullable(GarnishmentRequestGarnishmentType$outboundSchema) .optional(), times: z.nullable(z.number().int()).default(null), recurring: z.boolean().default(false), annualMaximum: z.nullable(z.string()).default(null), payPeriodMaximum: z.nullable(z.string()).default(null), deductAsPercentage: z.boolean().default(false), totalAmount: z.nullable(z.string()).optional(), childSupport: z.nullable(GarnishmentChildSupport$outboundSchema).optional(), }).transform((v) => { return remap$(v, { courtOrdered: "court_ordered", garnishmentType: "garnishment_type", annualMaximum: "annual_maximum", payPeriodMaximum: "pay_period_maximum", deductAsPercentage: "deduct_as_percentage", totalAmount: "total_amount", childSupport: "child_support", }); }); export function garnishmentRequestToJSON( garnishmentRequest: GarnishmentRequest, ): string { return JSON.stringify( GarnishmentRequest$outboundSchema.parse(garnishmentRequest), ); }