/* * 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"; export type ActiveCompanies = { /** * unique identifier for the company associated with the invoice data */ companyUuid?: string | undefined; /** * The number of active employees the company was or will be invoiced for that invoice period. Active employees are calculated as the count of onboarded employees hired before the end of the invoice period and not terminated before the start of the invoice period. */ activeEmployees?: number | undefined; /** * The number of active contractors the company was or will be invoiced for that invoice period. Active contractors are calculated as any contractor with an active contractor payment during the invoice period. */ activeContractors?: number | undefined; /** * The first invoice period for the company. This will either be the invoice period of the first invoice-able event (first payroll or contractor payment) or the date they migrated to embedded, whichever is later. */ initialInvoicePeriod?: string | undefined; }; /** * Representation of a partners invoice data */ export type InvoiceData = { /** * The list of companies that are active within the invoice period */ activeCompanies?: Array | undefined; }; /** @internal */ export const ActiveCompanies$inboundSchema: z.ZodType< ActiveCompanies, z.ZodTypeDef, unknown > = z.object({ company_uuid: z.string().optional(), active_employees: z.number().int().optional(), active_contractors: z.number().int().optional(), initial_invoice_period: z.string().optional(), }).transform((v) => { return remap$(v, { "company_uuid": "companyUuid", "active_employees": "activeEmployees", "active_contractors": "activeContractors", "initial_invoice_period": "initialInvoicePeriod", }); }); export function activeCompaniesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ActiveCompanies$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ActiveCompanies' from JSON`, ); } /** @internal */ export const InvoiceData$inboundSchema: z.ZodType< InvoiceData, z.ZodTypeDef, unknown > = z.object({ active_companies: z.array(z.lazy(() => ActiveCompanies$inboundSchema)) .optional(), }).transform((v) => { return remap$(v, { "active_companies": "activeCompanies", }); }); export function invoiceDataFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => InvoiceData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InvoiceData' from JSON`, ); }