/* * 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"; /** * The payment method. */ export const ContractorPaymentPaymentMethod = { DirectDeposit: "Direct Deposit", Check: "Check", HistoricalPayment: "Historical Payment", CorrectionPayment: "Correction Payment", } as const; /** * The payment method. */ export type ContractorPaymentPaymentMethod = ClosedEnum< typeof ContractorPaymentPaymentMethod >; /** * Contractor payment status */ export const ContractorPaymentStatus = { Funded: "Funded", Unfunded: "Unfunded", } as const; /** * Contractor payment status */ export type ContractorPaymentStatus = ClosedEnum< typeof ContractorPaymentStatus >; /** * The wage type for the payment. */ export const ContractorPaymentWageType = { Hourly: "Hourly", Fixed: "Fixed", } as const; /** * The wage type for the payment. */ export type ContractorPaymentWageType = ClosedEnum< typeof ContractorPaymentWageType >; /** * The representation of a single contractor payment. */ export type ContractorPayment = { /** * The unique identifier of the contractor payment in Gusto. */ uuid: string; /** * The UUID of the contractor. */ contractorUuid?: string | undefined; /** * The bonus amount in the payment. */ bonus?: string | undefined; /** * The payment date. */ date?: string | undefined; /** * The number of hours worked for the payment. */ hours?: string | undefined; /** * The payment method. */ paymentMethod?: ContractorPaymentPaymentMethod | undefined; /** * The reimbursement amount in the payment. */ reimbursement?: string | undefined; /** * Contractor payment status */ status?: ContractorPaymentStatus | undefined; /** * The rate per hour worked for the payment. */ hourlyRate?: string | undefined; /** * Determine if the contractor payment can be cancelled. */ mayCancel?: boolean | undefined; /** * The fixed wage of the payment, regardless of hours worked. */ wage?: string | undefined; /** * The wage type for the payment. */ wageType?: ContractorPaymentWageType | undefined; /** * (hours * hourly_rate) + wage + bonus */ wageTotal?: string | undefined; }; /** @internal */ export const ContractorPaymentPaymentMethod$inboundSchema: z.ZodNativeEnum< typeof ContractorPaymentPaymentMethod > = z.nativeEnum(ContractorPaymentPaymentMethod); /** @internal */ export const ContractorPaymentStatus$inboundSchema: z.ZodNativeEnum< typeof ContractorPaymentStatus > = z.nativeEnum(ContractorPaymentStatus); /** @internal */ export const ContractorPaymentWageType$inboundSchema: z.ZodNativeEnum< typeof ContractorPaymentWageType > = z.nativeEnum(ContractorPaymentWageType); /** @internal */ export const ContractorPayment$inboundSchema: z.ZodType< ContractorPayment, z.ZodTypeDef, unknown > = z.object({ uuid: z.string(), contractor_uuid: z.string().optional(), bonus: z.string().optional(), date: z.string().optional(), hours: z.string().optional(), payment_method: ContractorPaymentPaymentMethod$inboundSchema.optional(), reimbursement: z.string().optional(), status: ContractorPaymentStatus$inboundSchema.optional(), hourly_rate: z.string().optional(), may_cancel: z.boolean().optional(), wage: z.string().optional(), wage_type: ContractorPaymentWageType$inboundSchema.optional(), wage_total: z.string().optional(), }).transform((v) => { return remap$(v, { "contractor_uuid": "contractorUuid", "payment_method": "paymentMethod", "hourly_rate": "hourlyRate", "may_cancel": "mayCancel", "wage_type": "wageType", "wage_total": "wageTotal", }); }); export function contractorPaymentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ContractorPayment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContractorPayment' from JSON`, ); }