/* * 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 BenefitSummaryPayPeriod = { /** * The beginning of the payroll's pay period. */ startDate?: string | null | undefined; /** * The end of the payroll's pay period. */ endDate?: string | null | undefined; }; export type PayrollBenefits = { payrollUuid?: string | undefined; /** * Whether it is regular or bonus payroll */ payrollType?: string | undefined; /** * Check date of this payroll. */ checkDate?: string | undefined; /** * Gross pay for this employee on the payroll. */ grossPay?: string | undefined; /** * Total imputed pay for this employee on the payroll. */ imputedPay?: string | undefined; /** * The employee benefit deduction amount for this employee on the payroll. */ companyBenefitDeduction?: string | undefined; /** * The company contribution amount for this employee on the payroll. */ companyBenefitContribution?: string | undefined; payPeriod?: BenefitSummaryPayPeriod | undefined; }; export type BenefitSummaryEmployees = { /** * The UUID of the employee */ uuid?: string | undefined; /** * The sum of employee deduction for this employee given the period of time and the specific company benefit. */ companyBenefitDeduction?: string | undefined; /** * The sum of company contribution for this employee given the period of time and the specific company benefit. */ companyBenefitContribution?: string | undefined; /** * The sum of employee benefit deduction for this employee given the period of time and the benefit type. */ benefitDeduction?: string | undefined; /** * The sum of company contribution for this employee given the period of time and the benefit type. */ benefitContribution?: string | undefined; /** * Gross pay for this employee given the period of time. */ grossPay?: string | undefined; /** * Total imputed pay for this employee given the period of time (not scoped to a benefit type). */ imputedPay?: string | undefined; payrollBenefits?: Array | undefined; }; export type BenefitSummary = { /** * The start date of benefit summary. */ startDate?: string | undefined; /** * The end date of benefit summary. */ endDate?: string | undefined; /** * Description of the benefit. */ description?: string | undefined; /** * The aggregate of employee deduction for all employees given the period of time and the specific company benefit. */ companyBenefitDeduction?: string | undefined; /** * The aggregate of company contribution for all employees given the period of time and the specific company benefit. */ companyBenefitContribution?: string | undefined; employees?: Array | undefined; }; /** @internal */ export const BenefitSummaryPayPeriod$inboundSchema: z.ZodType< BenefitSummaryPayPeriod, z.ZodTypeDef, unknown > = z.object({ start_date: z.nullable(z.string()).optional(), end_date: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "start_date": "startDate", "end_date": "endDate", }); }); export function benefitSummaryPayPeriodFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BenefitSummaryPayPeriod$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BenefitSummaryPayPeriod' from JSON`, ); } /** @internal */ export const PayrollBenefits$inboundSchema: z.ZodType< PayrollBenefits, z.ZodTypeDef, unknown > = z.object({ payroll_uuid: z.string().optional(), payroll_type: z.string().optional(), check_date: z.string().optional(), gross_pay: z.string().optional(), imputed_pay: z.string().optional(), company_benefit_deduction: z.string().optional(), company_benefit_contribution: z.string().optional(), pay_period: z.lazy(() => BenefitSummaryPayPeriod$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "payroll_uuid": "payrollUuid", "payroll_type": "payrollType", "check_date": "checkDate", "gross_pay": "grossPay", "imputed_pay": "imputedPay", "company_benefit_deduction": "companyBenefitDeduction", "company_benefit_contribution": "companyBenefitContribution", "pay_period": "payPeriod", }); }); export function payrollBenefitsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PayrollBenefits$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PayrollBenefits' from JSON`, ); } /** @internal */ export const BenefitSummaryEmployees$inboundSchema: z.ZodType< BenefitSummaryEmployees, z.ZodTypeDef, unknown > = z.object({ uuid: z.string().optional(), company_benefit_deduction: z.string().optional(), company_benefit_contribution: z.string().optional(), benefit_deduction: z.string().optional(), benefit_contribution: z.string().optional(), gross_pay: z.string().optional(), imputed_pay: z.string().optional(), payroll_benefits: z.array(z.lazy(() => PayrollBenefits$inboundSchema)) .optional(), }).transform((v) => { return remap$(v, { "company_benefit_deduction": "companyBenefitDeduction", "company_benefit_contribution": "companyBenefitContribution", "benefit_deduction": "benefitDeduction", "benefit_contribution": "benefitContribution", "gross_pay": "grossPay", "imputed_pay": "imputedPay", "payroll_benefits": "payrollBenefits", }); }); export function benefitSummaryEmployeesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BenefitSummaryEmployees$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BenefitSummaryEmployees' from JSON`, ); } /** @internal */ export const BenefitSummary$inboundSchema: z.ZodType< BenefitSummary, z.ZodTypeDef, unknown > = z.object({ start_date: z.string().optional(), end_date: z.string().optional(), description: z.string().optional(), company_benefit_deduction: z.string().optional(), company_benefit_contribution: z.string().optional(), employees: z.array(z.lazy(() => BenefitSummaryEmployees$inboundSchema)) .optional(), }).transform((v) => { return remap$(v, { "start_date": "startDate", "end_date": "endDate", "company_benefit_deduction": "companyBenefitDeduction", "company_benefit_contribution": "companyBenefitContribution", }); }); export function benefitSummaryFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BenefitSummary$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BenefitSummary' from JSON`, ); }