/* * 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 ContractorPaymentForGroupPreviewPaymentMethod = { DirectDeposit: "Direct Deposit", Check: "Check", HistoricalPayment: "Historical Payment", CorrectionPayment: "Correction Payment", } as const; /** * The payment method. */ export type ContractorPaymentForGroupPreviewPaymentMethod = ClosedEnum< typeof ContractorPaymentForGroupPreviewPaymentMethod >; /** * The status of the contractor payment. Will transition to `Funded` during payments processing if the payment should be funded, i.e. has `Direct Deposit` for payment method. Contractors payments with `Check` payment method will remain `Unfunded`. */ export const ContractorPaymentForGroupPreviewStatus = { Funded: "Funded", Unfunded: "Unfunded", } as const; /** * The status of the contractor payment. Will transition to `Funded` during payments processing if the payment should be funded, i.e. has `Direct Deposit` for payment method. Contractors payments with `Check` payment method will remain `Unfunded`. */ export type ContractorPaymentForGroupPreviewStatus = ClosedEnum< typeof ContractorPaymentForGroupPreviewStatus >; /** * The wage type for the payment. */ export const ContractorPaymentForGroupPreviewWageType = { Hourly: "Hourly", Fixed: "Fixed", } as const; /** * The wage type for the payment. */ export type ContractorPaymentForGroupPreviewWageType = ClosedEnum< typeof ContractorPaymentForGroupPreviewWageType >; /** * Preview representation of a single contractor payment with nullable uuid. */ export type ContractorPaymentForGroupPreview = { /** * The unique identifier of the contractor payment in Gusto. */ uuid?: string | null | undefined; /** * The UUID of the contractor. */ contractorUuid?: string | undefined; /** * The bonus amount in the payment. */ bonus?: string | undefined; /** * The number of hours worked for the payment. */ hours?: string | undefined; /** * The payment method. */ paymentMethod?: ContractorPaymentForGroupPreviewPaymentMethod | undefined; /** * The reimbursement amount in the payment. */ reimbursement?: string | undefined; /** * The status of the contractor payment. Will transition to `Funded` during payments processing if the payment should be funded, i.e. has `Direct Deposit` for payment method. Contractors payments with `Check` payment method will remain `Unfunded`. */ status?: ContractorPaymentForGroupPreviewStatus | 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?: ContractorPaymentForGroupPreviewWageType | undefined; /** * (hours * hourly_rate) + wage + bonus */ wageTotal?: string | undefined; }; /** @internal */ export const ContractorPaymentForGroupPreviewPaymentMethod$inboundSchema: z.ZodNativeEnum = z .nativeEnum(ContractorPaymentForGroupPreviewPaymentMethod); /** @internal */ export const ContractorPaymentForGroupPreviewStatus$inboundSchema: z.ZodNativeEnum = z.nativeEnum( ContractorPaymentForGroupPreviewStatus, ); /** @internal */ export const ContractorPaymentForGroupPreviewWageType$inboundSchema: z.ZodNativeEnum = z .nativeEnum(ContractorPaymentForGroupPreviewWageType); /** @internal */ export const ContractorPaymentForGroupPreview$inboundSchema: z.ZodType< ContractorPaymentForGroupPreview, z.ZodTypeDef, unknown > = z.object({ uuid: z.nullable(z.string()).optional(), contractor_uuid: z.string().optional(), bonus: z.string().optional(), hours: z.string().optional(), payment_method: ContractorPaymentForGroupPreviewPaymentMethod$inboundSchema .optional(), reimbursement: z.string().optional(), status: ContractorPaymentForGroupPreviewStatus$inboundSchema.optional(), hourly_rate: z.string().optional(), may_cancel: z.boolean().optional(), wage: z.string().optional(), wage_type: ContractorPaymentForGroupPreviewWageType$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 contractorPaymentForGroupPreviewFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ContractorPaymentForGroupPreview$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContractorPaymentForGroupPreview' from JSON`, ); }