/* * 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 ContractorPaymentSummaryByDatesTotal = { /** * 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 ContractorPaymentSummaryByDatesContractorPayments = { /** * The UUID of the contractor. */ contractorUuid?: string | undefined; /** * The payment check date. */ checkDate?: string | 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 ContractorPaymentSummaryByDates = { /** * The wage and reimbursement totals for all contractor payments within a given time period. */ total?: ContractorPaymentSummaryByDatesTotal | undefined; /** * The individual contractor payments, within a given time period, grouped by check date. */ contractorPayments?: | Array | undefined; }; /** @internal */ export const ContractorPaymentSummaryByDatesTotal$inboundSchema: z.ZodType< ContractorPaymentSummaryByDatesTotal, z.ZodTypeDef, unknown > = z.object({ reimbursements: z.string().optional(), wages: z.string().optional(), }); export function contractorPaymentSummaryByDatesTotalFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ContractorPaymentSummaryByDatesTotal$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContractorPaymentSummaryByDatesTotal' from JSON`, ); } /** @internal */ export const ContractorPaymentSummaryByDatesContractorPayments$inboundSchema: z.ZodType< ContractorPaymentSummaryByDatesContractorPayments, z.ZodTypeDef, unknown > = z.object({ contractor_uuid: z.string().optional(), check_date: z.string().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", "check_date": "checkDate", "reimbursement_total": "reimbursementTotal", "wage_total": "wageTotal", }); }); export function contractorPaymentSummaryByDatesContractorPaymentsFromJSON( jsonString: string, ): SafeParseResult< ContractorPaymentSummaryByDatesContractorPayments, SDKValidationError > { return safeParse( jsonString, (x) => ContractorPaymentSummaryByDatesContractorPayments$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'ContractorPaymentSummaryByDatesContractorPayments' from JSON`, ); } /** @internal */ export const ContractorPaymentSummaryByDates$inboundSchema: z.ZodType< ContractorPaymentSummaryByDates, z.ZodTypeDef, unknown > = z.object({ total: z.lazy(() => ContractorPaymentSummaryByDatesTotal$inboundSchema) .optional(), contractor_payments: z.array( z.lazy(() => ContractorPaymentSummaryByDatesContractorPayments$inboundSchema ), ).optional(), }).transform((v) => { return remap$(v, { "contractor_payments": "contractorPayments", }); }); export function contractorPaymentSummaryByDatesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ContractorPaymentSummaryByDates$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContractorPaymentSummaryByDates' from JSON`, ); }