/* * 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 { RFCDate } from "../../types/rfcdate.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * The payment method. */ export const ContractorPaymentListingPaymentMethod = { DirectDeposit: "Direct Deposit", Check: "Check", HistoricalPayment: "Historical Payment", CorrectionPayment: "Correction Payment", } as const; /** * The payment method. */ export type ContractorPaymentListingPaymentMethod = ClosedEnum< typeof ContractorPaymentListingPaymentMethod >; /** * Contractor payment status */ export const ContractorPaymentListingStatus = { Funded: "Funded", Unfunded: "Unfunded", } as const; /** * Contractor payment status */ export type ContractorPaymentListingStatus = ClosedEnum< typeof ContractorPaymentListingStatus >; /** * The wage type for the payment. */ export const ContractorPaymentListingWageType = { Hourly: "Hourly", Fixed: "Fixed", } as const; /** * The wage type for the payment. */ export type ContractorPaymentListingWageType = ClosedEnum< typeof ContractorPaymentListingWageType >; /** * The representation of a contractor payment as it appears in a contractor's payment history. */ export type ContractorPaymentListing = { /** * The unique identifier of the contractor payment in Gusto. */ uuid: string; /** * The check date for the payment. */ checkDate?: RFCDate | undefined; /** * The bonus amount in the payment. */ bonus?: string | undefined; /** * The number of hours worked for the payment. */ hours?: string | undefined; /** * The rate per hour worked for the payment. */ hourlyRate?: string | undefined; /** * The payment method. */ paymentMethod?: ContractorPaymentListingPaymentMethod | undefined; /** * The reimbursement amount in the payment. */ reimbursement?: string | undefined; /** * Contractor payment status */ status?: ContractorPaymentListingStatus | undefined; /** * The fixed wage of the payment, regardless of hours worked. */ wage?: string | undefined; /** * The wage type for the payment. */ wageType?: ContractorPaymentListingWageType | undefined; /** * (hours * hourly_rate) + wage + bonus */ wageTotal?: string | undefined; }; /** @internal */ export const ContractorPaymentListingPaymentMethod$inboundSchema: z.ZodNativeEnum = z.nativeEnum( ContractorPaymentListingPaymentMethod, ); /** @internal */ export const ContractorPaymentListingStatus$inboundSchema: z.ZodNativeEnum< typeof ContractorPaymentListingStatus > = z.nativeEnum(ContractorPaymentListingStatus); /** @internal */ export const ContractorPaymentListingWageType$inboundSchema: z.ZodNativeEnum< typeof ContractorPaymentListingWageType > = z.nativeEnum(ContractorPaymentListingWageType); /** @internal */ export const ContractorPaymentListing$inboundSchema: z.ZodType< ContractorPaymentListing, z.ZodTypeDef, unknown > = z.object({ uuid: z.string(), check_date: z.string().transform(v => new RFCDate(v)).optional(), bonus: z.string().optional(), hours: z.string().optional(), hourly_rate: z.string().optional(), payment_method: ContractorPaymentListingPaymentMethod$inboundSchema .optional(), reimbursement: z.string().optional(), status: ContractorPaymentListingStatus$inboundSchema.optional(), wage: z.string().optional(), wage_type: ContractorPaymentListingWageType$inboundSchema.optional(), wage_total: z.string().optional(), }).transform((v) => { return remap$(v, { "check_date": "checkDate", "hourly_rate": "hourlyRate", "payment_method": "paymentMethod", "wage_type": "wageType", "wage_total": "wageTotal", }); }); export function contractorPaymentListingFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ContractorPaymentListing$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContractorPaymentListing' from JSON`, ); }