/* * 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 { ClosedEnum } from "../../types/enums.js"; /** * The earning type class name. */ export const ExternalPayrollUpdateRequestEarningType = { CompanyPayType: "CompanyPayType", CompanyEarningType: "CompanyEarningType", } as const; /** * The earning type class name. */ export type ExternalPayrollUpdateRequestEarningType = ClosedEnum< typeof ExternalPayrollUpdateRequestEarningType >; export type ExternalPayrollUpdateRequestEarnings = { /** * The earning type class name. */ earningType?: ExternalPayrollUpdateRequestEarningType | undefined; /** * The ID of the earning type. */ earningId?: number | undefined; /** * The earning amount in dollars. */ amount?: string | undefined; /** * The number of hours worked. */ hours?: string | undefined; }; export type ExternalPayrollUpdateRequestBenefits = { /** * The ID of the company benefit. */ benefitId?: number | undefined; /** * The company contribution amount in dollars. */ companyContributionAmount?: string | undefined; /** * The employee deduction amount in dollars. */ employeeDeductionAmount?: string | undefined; }; export type ExternalPayrollUpdateRequestTaxes = { /** * The ID of the tax. */ taxId?: number | undefined; /** * The tax amount in dollars. */ amount?: string | undefined; }; export type ExternalPayrollUpdateRequestExternalPayrollItems = { /** * The UUID of the employee. */ employeeUuid: string; /** * Earnings for the employee. */ earnings?: Array | undefined; /** * Benefits for the employee. */ benefits?: Array | undefined; /** * Taxes for the employee. */ taxes?: Array | undefined; }; /** * The request body for updating an external payroll with employee payroll items. */ export type ExternalPayrollUpdateRequest = { /** * Patch update external payroll items when set to true, otherwise it will overwrite the previous changes. */ replaceFields?: boolean | undefined; /** * Payroll items for each employee in the external payroll. */ externalPayrollItems: Array; }; /** @internal */ export const ExternalPayrollUpdateRequestEarningType$outboundSchema: z.ZodNativeEnum = z .nativeEnum(ExternalPayrollUpdateRequestEarningType); /** @internal */ export type ExternalPayrollUpdateRequestEarnings$Outbound = { earning_type?: string | undefined; earning_id?: number | undefined; amount?: string | undefined; hours?: string | undefined; }; /** @internal */ export const ExternalPayrollUpdateRequestEarnings$outboundSchema: z.ZodType< ExternalPayrollUpdateRequestEarnings$Outbound, z.ZodTypeDef, ExternalPayrollUpdateRequestEarnings > = z.object({ earningType: ExternalPayrollUpdateRequestEarningType$outboundSchema .optional(), earningId: z.number().int().optional(), amount: z.string().optional(), hours: z.string().optional(), }).transform((v) => { return remap$(v, { earningType: "earning_type", earningId: "earning_id", }); }); export function externalPayrollUpdateRequestEarningsToJSON( externalPayrollUpdateRequestEarnings: ExternalPayrollUpdateRequestEarnings, ): string { return JSON.stringify( ExternalPayrollUpdateRequestEarnings$outboundSchema.parse( externalPayrollUpdateRequestEarnings, ), ); } /** @internal */ export type ExternalPayrollUpdateRequestBenefits$Outbound = { benefit_id?: number | undefined; company_contribution_amount?: string | undefined; employee_deduction_amount?: string | undefined; }; /** @internal */ export const ExternalPayrollUpdateRequestBenefits$outboundSchema: z.ZodType< ExternalPayrollUpdateRequestBenefits$Outbound, z.ZodTypeDef, ExternalPayrollUpdateRequestBenefits > = z.object({ benefitId: z.number().int().optional(), companyContributionAmount: z.string().optional(), employeeDeductionAmount: z.string().optional(), }).transform((v) => { return remap$(v, { benefitId: "benefit_id", companyContributionAmount: "company_contribution_amount", employeeDeductionAmount: "employee_deduction_amount", }); }); export function externalPayrollUpdateRequestBenefitsToJSON( externalPayrollUpdateRequestBenefits: ExternalPayrollUpdateRequestBenefits, ): string { return JSON.stringify( ExternalPayrollUpdateRequestBenefits$outboundSchema.parse( externalPayrollUpdateRequestBenefits, ), ); } /** @internal */ export type ExternalPayrollUpdateRequestTaxes$Outbound = { tax_id?: number | undefined; amount?: string | undefined; }; /** @internal */ export const ExternalPayrollUpdateRequestTaxes$outboundSchema: z.ZodType< ExternalPayrollUpdateRequestTaxes$Outbound, z.ZodTypeDef, ExternalPayrollUpdateRequestTaxes > = z.object({ taxId: z.number().int().optional(), amount: z.string().optional(), }).transform((v) => { return remap$(v, { taxId: "tax_id", }); }); export function externalPayrollUpdateRequestTaxesToJSON( externalPayrollUpdateRequestTaxes: ExternalPayrollUpdateRequestTaxes, ): string { return JSON.stringify( ExternalPayrollUpdateRequestTaxes$outboundSchema.parse( externalPayrollUpdateRequestTaxes, ), ); } /** @internal */ export type ExternalPayrollUpdateRequestExternalPayrollItems$Outbound = { employee_uuid: string; earnings?: Array | undefined; benefits?: Array | undefined; taxes?: Array | undefined; }; /** @internal */ export const ExternalPayrollUpdateRequestExternalPayrollItems$outboundSchema: z.ZodType< ExternalPayrollUpdateRequestExternalPayrollItems$Outbound, z.ZodTypeDef, ExternalPayrollUpdateRequestExternalPayrollItems > = z.object({ employeeUuid: z.string(), earnings: z.array( z.lazy(() => ExternalPayrollUpdateRequestEarnings$outboundSchema), ).optional(), benefits: z.array( z.lazy(() => ExternalPayrollUpdateRequestBenefits$outboundSchema), ).optional(), taxes: z.array( z.lazy(() => ExternalPayrollUpdateRequestTaxes$outboundSchema), ).optional(), }).transform((v) => { return remap$(v, { employeeUuid: "employee_uuid", }); }); export function externalPayrollUpdateRequestExternalPayrollItemsToJSON( externalPayrollUpdateRequestExternalPayrollItems: ExternalPayrollUpdateRequestExternalPayrollItems, ): string { return JSON.stringify( ExternalPayrollUpdateRequestExternalPayrollItems$outboundSchema.parse( externalPayrollUpdateRequestExternalPayrollItems, ), ); } /** @internal */ export type ExternalPayrollUpdateRequest$Outbound = { replace_fields?: boolean | undefined; external_payroll_items: Array< ExternalPayrollUpdateRequestExternalPayrollItems$Outbound >; }; /** @internal */ export const ExternalPayrollUpdateRequest$outboundSchema: z.ZodType< ExternalPayrollUpdateRequest$Outbound, z.ZodTypeDef, ExternalPayrollUpdateRequest > = z.object({ replaceFields: z.boolean().optional(), externalPayrollItems: z.array( z.lazy(() => ExternalPayrollUpdateRequestExternalPayrollItems$outboundSchema ), ), }).transform((v) => { return remap$(v, { replaceFields: "replace_fields", externalPayrollItems: "external_payroll_items", }); }); export function externalPayrollUpdateRequestToJSON( externalPayrollUpdateRequest: ExternalPayrollUpdateRequest, ): string { return JSON.stringify( ExternalPayrollUpdateRequest$outboundSchema.parse( externalPayrollUpdateRequest, ), ); }