/* * 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"; /** * How often the agency collects the withholding amount. e.g. $500 monthly -> `Monthly`. */ export const PaymentPeriod = { EveryWeek: "Every week", EveryOtherWeek: "Every other week", TwicePerMonth: "Twice per month", Monthly: "Monthly", } as const; /** * How often the agency collects the withholding amount. e.g. $500 monthly -> `Monthly`. */ export type PaymentPeriod = ClosedEnum; /** * Additional child support order details */ export type GarnishmentChildSupport = { /** * The two letter state abbreviation for the state issuing the child support order. Agency data is available in the `GET /v1/garnishments/child_support` API. */ state?: string | undefined; /** * How often the agency collects the withholding amount. e.g. $500 monthly -> `Monthly`. */ paymentPeriod?: PaymentPeriod | undefined; /** * The FIPS code associated with the state or county agency issuing the child support order. Agency data is available in the `GET /v1/garnishments/child_support` API. */ fipsCode?: string | undefined; /** * Child Support Enforcement Case Number associated with this child support obligation - required for most states. Agency specific requirements are available in the `GET /v1/garnishments/child_support` API. */ caseNumber?: string | null | undefined; /** * Order Identifier or Order ID associated with this child support obligation - required for some states. Agency specific requirements are available in the `GET /v1/garnishments/child_support` API. */ orderNumber?: string | null | undefined; /** * Child Support Enforcement Remittance ID associated with this child support obligation - required for some states. Agency specific requirements are available in the `GET /v1/garnishments/child_support` API. */ remittanceNumber?: string | null | undefined; }; /** @internal */ export const PaymentPeriod$inboundSchema: z.ZodNativeEnum< typeof PaymentPeriod > = z.nativeEnum(PaymentPeriod); /** @internal */ export const PaymentPeriod$outboundSchema: z.ZodNativeEnum< typeof PaymentPeriod > = PaymentPeriod$inboundSchema; /** @internal */ export const GarnishmentChildSupport$inboundSchema: z.ZodType< GarnishmentChildSupport, z.ZodTypeDef, unknown > = z.object({ state: z.string().optional(), payment_period: PaymentPeriod$inboundSchema.optional(), fips_code: z.string().optional(), case_number: z.nullable(z.string()).optional(), order_number: z.nullable(z.string()).optional(), remittance_number: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "payment_period": "paymentPeriod", "fips_code": "fipsCode", "case_number": "caseNumber", "order_number": "orderNumber", "remittance_number": "remittanceNumber", }); }); /** @internal */ export type GarnishmentChildSupport$Outbound = { state?: string | undefined; payment_period?: string | undefined; fips_code?: string | undefined; case_number?: string | null | undefined; order_number?: string | null | undefined; remittance_number?: string | null | undefined; }; /** @internal */ export const GarnishmentChildSupport$outboundSchema: z.ZodType< GarnishmentChildSupport$Outbound, z.ZodTypeDef, GarnishmentChildSupport > = z.object({ state: z.string().optional(), paymentPeriod: PaymentPeriod$outboundSchema.optional(), fipsCode: z.string().optional(), caseNumber: z.nullable(z.string()).optional(), orderNumber: z.nullable(z.string()).optional(), remittanceNumber: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { paymentPeriod: "payment_period", fipsCode: "fips_code", caseNumber: "case_number", orderNumber: "order_number", remittanceNumber: "remittance_number", }); }); export function garnishmentChildSupportToJSON( garnishmentChildSupport: GarnishmentChildSupport, ): string { return JSON.stringify( GarnishmentChildSupport$outboundSchema.parse(garnishmentChildSupport), ); } export function garnishmentChildSupportFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GarnishmentChildSupport$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GarnishmentChildSupport' from JSON`, ); }