/* * 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 { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ContractorPayment, ContractorPayment$inboundSchema, } from "./contractorpayment.js"; /** * The wage and reimbursement totals for all contractor payments within a given time period. */ export type Total = { /** * The total reimbursements for contractor payments within a given time period. */ reimbursements?: string | undefined; /** * The total wages for contractor payments within a given time period. */ wages?: string | undefined; }; export type ContractorPaymentSummaryContractorPayments = { /** * The UUID of the contractor. */ contractorUuid?: number | undefined; /** * The total reimbursements for the contractor within a given time period. */ reimbursementTotal?: string | undefined; /** * The total wages for the contractor within a given time period. */ wageTotal?: string | undefined; /** * The contractor's payments within a given time period. */ payments?: Array | undefined; }; /** * The representation of the summary of contractor payments for a given company in a given time period. */ export type ContractorPaymentSummary = { /** * The wage and reimbursement totals for all contractor payments within a given time period. */ total?: Total | undefined; /** * The individual contractor payments, within a given time period, grouped by contractor. */ contractorPayments?: | Array | undefined; }; /** @internal */ export const Total$inboundSchema: z.ZodType = z .object({ reimbursements: z.string().optional(), wages: z.string().optional(), }); export function totalFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Total$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Total' from JSON`, ); } /** @internal */ export const ContractorPaymentSummaryContractorPayments$inboundSchema: z.ZodType = z.object({ contractor_uuid: z.number().optional(), reimbursement_total: z.string().optional(), wage_total: z.string().optional(), payments: z.array(ContractorPayment$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "contractor_uuid": "contractorUuid", "reimbursement_total": "reimbursementTotal", "wage_total": "wageTotal", }); }); export function contractorPaymentSummaryContractorPaymentsFromJSON( jsonString: string, ): SafeParseResult< ContractorPaymentSummaryContractorPayments, SDKValidationError > { return safeParse( jsonString, (x) => ContractorPaymentSummaryContractorPayments$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'ContractorPaymentSummaryContractorPayments' from JSON`, ); } /** @internal */ export const ContractorPaymentSummary$inboundSchema: z.ZodType< ContractorPaymentSummary, z.ZodTypeDef, unknown > = z.object({ total: z.lazy(() => Total$inboundSchema).optional(), contractor_payments: z.array( z.lazy(() => ContractorPaymentSummaryContractorPayments$inboundSchema), ).optional(), }).transform((v) => { return remap$(v, { "contractor_payments": "contractorPayments", }); }); export function contractorPaymentSummaryFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ContractorPaymentSummary$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContractorPaymentSummary' from JSON`, ); }