/* * 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"; /** * Status of the recovery case */ export const RecoveryCaseStatus = { Open: "open", RedebitInitiated: "redebit_initiated", WireInitiated: "wire_initiated", Recovered: "recovered", Lost: "lost", } as const; /** * Status of the recovery case */ export type RecoveryCaseStatus = ClosedEnum; /** * Representation of a recovery case */ export type RecoveryCase = { /** * Unique identifier of an recovery case */ uuid: string; /** * Unique identifier of the company to which the recovery case belongs */ companyUuid?: string | undefined; /** * Status of the recovery case */ status?: RecoveryCaseStatus | undefined; /** * The latest bank error code for the recovery case. See [this doc](https://docs.gusto.com/embedded-payroll/docs/ach-codes-and-transaction-types) for a list of common ACH return codes. */ latestErrorCode?: string | null | undefined; /** * Date when funds were originally debited from the company's bank account */ originalDebitDate?: string | null | undefined; /** * Check date for the associated payroll or contractor payments */ checkDate?: string | undefined; /** * The uuid of the associated payroll for which the recovery case was created. If the recovery case was created for a contractor payment, this field will be null. */ payrollUuid?: string | null | undefined; /** * The uuids of the associated contractor payments for which the recovery case was created. If the recovery case was created for a payroll, this field will be null. */ contractorPaymentUuids?: Array | null | undefined; /** * Amount outstanding for the recovery case */ amountOutstanding?: string | undefined; /** * Total amount to be debited from the payroll or contractor payments */ eventTotalAmount?: string | undefined; }; /** @internal */ export const RecoveryCaseStatus$inboundSchema: z.ZodNativeEnum< typeof RecoveryCaseStatus > = z.nativeEnum(RecoveryCaseStatus); /** @internal */ export const RecoveryCase$inboundSchema: z.ZodType< RecoveryCase, z.ZodTypeDef, unknown > = z.object({ uuid: z.string(), company_uuid: z.string().optional(), status: RecoveryCaseStatus$inboundSchema.optional(), latest_error_code: z.nullable(z.string()).optional(), original_debit_date: z.nullable(z.string()).optional(), check_date: z.string().optional(), payroll_uuid: z.nullable(z.string()).optional(), contractor_payment_uuids: z.nullable(z.array(z.string())).optional(), amount_outstanding: z.string().optional(), event_total_amount: z.string().optional(), }).transform((v) => { return remap$(v, { "company_uuid": "companyUuid", "latest_error_code": "latestErrorCode", "original_debit_date": "originalDebitDate", "check_date": "checkDate", "payroll_uuid": "payrollUuid", "contractor_payment_uuids": "contractorPaymentUuids", "amount_outstanding": "amountOutstanding", "event_total_amount": "eventTotalAmount", }); }); export function recoveryCaseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RecoveryCase$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RecoveryCase' from JSON`, ); }