/* * 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 { ClosedEnum } from "../../types/enums.js"; import { RFCDate } from "../../types/rfcdate.js"; export const ContractorPaymentBodyPaymentMethod = { DirectDeposit: "Direct Deposit", Check: "Check", HistoricalPayment: "Historical Payment", } as const; export type ContractorPaymentBodyPaymentMethod = ClosedEnum< typeof ContractorPaymentBodyPaymentMethod >; /** * Request body for creating a contractor payment. */ export type ContractorPaymentBody = { /** * The contractor receiving the payment. */ contractorUuid: string; /** * Date of contractor payment. */ date: RFCDate; paymentMethod?: ContractorPaymentBodyPaymentMethod | undefined; /** * If the contractor is on a fixed wage, this is the fixed wage payment for the contractor, regardless of hours worked. */ wage?: string | undefined; /** * If the contractor is on an hourly wage, this is the number of hours that the contractor worked for the payment. */ hours?: string | undefined; /** * If the contractor is on an hourly wage, this is the bonus the contractor earned. */ bonus?: string | undefined; /** * Reimbursed wages for the contractor. */ reimbursement?: string | undefined; }; /** @internal */ export const ContractorPaymentBodyPaymentMethod$outboundSchema: z.ZodNativeEnum< typeof ContractorPaymentBodyPaymentMethod > = z.nativeEnum(ContractorPaymentBodyPaymentMethod); /** @internal */ export type ContractorPaymentBody$Outbound = { contractor_uuid: string; date: string; payment_method: string; wage?: string | undefined; hours?: string | undefined; bonus?: string | undefined; reimbursement?: string | undefined; }; /** @internal */ export const ContractorPaymentBody$outboundSchema: z.ZodType< ContractorPaymentBody$Outbound, z.ZodTypeDef, ContractorPaymentBody > = z.object({ contractorUuid: z.string(), date: z.instanceof(RFCDate).transform(v => v.toString()), paymentMethod: ContractorPaymentBodyPaymentMethod$outboundSchema.default( "Direct Deposit", ), wage: z.string().optional(), hours: z.string().optional(), bonus: z.string().optional(), reimbursement: z.string().optional(), }).transform((v) => { return remap$(v, { contractorUuid: "contractor_uuid", paymentMethod: "payment_method", }); }); export function contractorPaymentBodyToJSON( contractorPaymentBody: ContractorPaymentBody, ): string { return JSON.stringify( ContractorPaymentBody$outboundSchema.parse(contractorPaymentBody), ); }