/* * 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"; import { ContractorPaymentForGroup, ContractorPaymentForGroup$inboundSchema, } from "./contractorpaymentforgroup.js"; import { PayrollCreditBlockerType, PayrollCreditBlockerType$inboundSchema, } from "./payrollcreditblockertype.js"; import { PayrollSubmissionBlockerType, PayrollSubmissionBlockerType$inboundSchema, } from "./payrollsubmissionblockertype.js"; /** * The status of the contractor payment group. Will be `Funded` if all payments that should be funded (i.e. have `Direct Deposit` for payment method) are funded. A group can have status `Funded` while having associated payments that have status `Unfunded`, i.e. payment with `Check` payment method. */ export const ContractorPaymentGroupStatus = { Unfunded: "Unfunded", Funded: "Funded", } as const; /** * The status of the contractor payment group. Will be `Funded` if all payments that should be funded (i.e. have `Direct Deposit` for payment method) are funded. A group can have status `Funded` while having associated payments that have status `Unfunded`, i.e. payment with `Check` payment method. */ export type ContractorPaymentGroupStatus = ClosedEnum< typeof ContractorPaymentGroupStatus >; export type ContractorPaymentGroupTotals = { /** * The total amount for the group of contractor payments. */ amount?: string | undefined; /** * The total debit amount for the group of contractor payments. Sum of wage & reimbursement amount. */ debitAmount?: string | undefined; /** * The total wage amount for the group of contractor payments. */ wageAmount?: string | undefined; /** * The total reimbursement amount for the group of contractor payments. */ reimbursementAmount?: string | undefined; /** * The total check amount for the group of contractor payments. */ checkAmount?: string | undefined; }; /** * The full contractor payment group, including associated contractor payments. */ export type ContractorPaymentGroup = { /** * The unique identifier of the contractor payment group. */ uuid?: string | undefined; /** * The UUID of the company. */ companyUuid?: string | undefined; /** * The check date of the contractor payment group. */ checkDate?: string | undefined; /** * The debit date of the contractor payment group. */ debitDate?: string | undefined; /** * The status of the contractor payment group. Will be `Funded` if all payments that should be funded (i.e. have `Direct Deposit` for payment method) are funded. A group can have status `Funded` while having associated payments that have status `Unfunded`, i.e. payment with `Check` payment method. */ status?: ContractorPaymentGroupStatus | undefined; /** * Token used to make contractor payment group creation idempotent. Will error if attempting to create a group with a duplicate token. */ creationToken?: string | null | undefined; /** * Whether the disbursement is partner owned. */ partnerOwnedDisbursement?: boolean | null | undefined; /** * List of submission blockers for the contractor payment group. */ submissionBlockers?: Array | undefined; /** * List of credit blockers for the contractor payment group. */ creditBlockers?: Array | undefined; totals?: ContractorPaymentGroupTotals | undefined; contractorPayments?: Array | undefined; }; /** @internal */ export const ContractorPaymentGroupStatus$inboundSchema: z.ZodNativeEnum< typeof ContractorPaymentGroupStatus > = z.nativeEnum(ContractorPaymentGroupStatus); /** @internal */ export const ContractorPaymentGroupTotals$inboundSchema: z.ZodType< ContractorPaymentGroupTotals, z.ZodTypeDef, unknown > = z.object({ amount: z.string().optional(), debit_amount: z.string().optional(), wage_amount: z.string().optional(), reimbursement_amount: z.string().optional(), check_amount: z.string().optional(), }).transform((v) => { return remap$(v, { "debit_amount": "debitAmount", "wage_amount": "wageAmount", "reimbursement_amount": "reimbursementAmount", "check_amount": "checkAmount", }); }); export function contractorPaymentGroupTotalsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ContractorPaymentGroupTotals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContractorPaymentGroupTotals' from JSON`, ); } /** @internal */ export const ContractorPaymentGroup$inboundSchema: z.ZodType< ContractorPaymentGroup, z.ZodTypeDef, unknown > = z.object({ uuid: z.string().optional(), company_uuid: z.string().optional(), check_date: z.string().optional(), debit_date: z.string().optional(), status: ContractorPaymentGroupStatus$inboundSchema.optional(), creation_token: z.nullable(z.string()).optional(), partner_owned_disbursement: z.nullable(z.boolean()).optional(), submission_blockers: z.array(PayrollSubmissionBlockerType$inboundSchema) .optional(), credit_blockers: z.array(PayrollCreditBlockerType$inboundSchema).optional(), totals: z.lazy(() => ContractorPaymentGroupTotals$inboundSchema).optional(), contractor_payments: z.array(ContractorPaymentForGroup$inboundSchema) .optional(), }).transform((v) => { return remap$(v, { "company_uuid": "companyUuid", "check_date": "checkDate", "debit_date": "debitDate", "creation_token": "creationToken", "partner_owned_disbursement": "partnerOwnedDisbursement", "submission_blockers": "submissionBlockers", "credit_blockers": "creditBlockers", "contractor_payments": "contractorPayments", }); }); export function contractorPaymentGroupFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ContractorPaymentGroup$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContractorPaymentGroup' from JSON`, ); }