/* * 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 { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export const PayrollUnprocessedEmployeeCompensationsTypePaymentMethod = { DirectDeposit: "Direct Deposit", Check: "Check", Historical: "Historical", } as const; export type PayrollUnprocessedEmployeeCompensationsTypePaymentMethod = ClosedEnum; export type PayrollUnprocessedEmployeeCompensationsTypeFixedCompensations = { /** * The name of the compensation. This also serves as the unique, immutable identifier for this compensation. */ name?: string | undefined; /** * The amount of the compensation for the pay period. */ amount?: string | undefined; /** * The UUID of the job for the compensation. */ jobUuid?: string | undefined; }; export type PayrollUnprocessedEmployeeCompensationsTypeHourlyCompensations = { /** * The name of the compensation. This also serves as the unique, immutable identifier for this compensation. */ name?: string | undefined; /** * The number of hours to be compensated for this pay period. */ hours?: string | undefined; /** * The amount of the compensation. This field is only available after the payroll is calculated and cannot be used for updating hourly compensations. */ amount?: string | undefined; /** * The UUID of the job for the compensation. */ jobUuid?: string | undefined; /** * The amount multiplied by the base rate to calculate total compensation per hour worked. */ compensationMultiplier?: number | undefined; /** * The FLSA Status of the employee's primary job compensation */ flsaStatus?: string | undefined; }; export type PayrollUnprocessedEmployeeCompensationsTypePaidTimeOff = { /** * The name of the PTO. This also serves as the unique, immutable identifier for the PTO. */ name?: string | undefined; /** * The hours of this PTO taken during the pay period. */ hours?: string | undefined; /** * The outstanding hours paid upon termination. This field is only applicable for termination payrolls. */ finalPayoutUnusedHoursInput?: string | null | undefined; }; export type PayrollUnprocessedEmployeeCompensationsTypeReimbursements = { /** * The dollar amount of the reimbursement for the pay period. */ amount: string; /** * The description of the reimbursement. Null for unnamed reimbursements. */ description: string | null; /** * The UUID of the reimbursement. Null for unnamed reimbursements. This field is only available for unprocessed payrolls. */ uuid?: string | null | undefined; /** * Whether the reimbursement is recurring. This field is only available for unprocessed payrolls. */ recurring?: boolean | undefined; }; /** * Override mode. Only `one_time` is currently exposed. */ export const PayrollUnprocessedEmployeeCompensationsTypeOverrideType = { OneTime: "one_time", } as const; /** * Override mode. Only `one_time` is currently exposed. */ export type PayrollUnprocessedEmployeeCompensationsTypeOverrideType = ClosedEnum; /** * How to interpret the amount. */ export const PayrollUnprocessedEmployeeCompensationsTypeAmountType = { Fixed: "fixed", Percent: "percent", } as const; /** * How to interpret the amount. */ export type PayrollUnprocessedEmployeeCompensationsTypeAmountType = ClosedEnum< typeof PayrollUnprocessedEmployeeCompensationsTypeAmountType >; /** * Federal one-time custom withholding override applied to this payroll. */ export type PayrollUnprocessedEmployeeCompensationsTypeFederal = { /** * Override mode. Only `one_time` is currently exposed. */ overrideType?: | PayrollUnprocessedEmployeeCompensationsTypeOverrideType | undefined; /** * The amount that was withheld for this payroll. */ amount?: string | undefined; /** * How to interpret the amount. */ amountType?: | PayrollUnprocessedEmployeeCompensationsTypeAmountType | undefined; }; /** * Override mode. Only `one_time` is currently exposed. */ export const PayrollUnprocessedEmployeeCompensationsTypeCustomWithholdingsOverrideType = { OneTime: "one_time", } as const; /** * Override mode. Only `one_time` is currently exposed. */ export type PayrollUnprocessedEmployeeCompensationsTypeCustomWithholdingsOverrideType = ClosedEnum< typeof PayrollUnprocessedEmployeeCompensationsTypeCustomWithholdingsOverrideType >; /** * How to interpret the amount. */ export const PayrollUnprocessedEmployeeCompensationsTypeCustomWithholdingsAmountType = { Fixed: "fixed", Percent: "percent", } as const; /** * How to interpret the amount. */ export type PayrollUnprocessedEmployeeCompensationsTypeCustomWithholdingsAmountType = ClosedEnum< typeof PayrollUnprocessedEmployeeCompensationsTypeCustomWithholdingsAmountType >; export type PayrollUnprocessedEmployeeCompensationsTypeState = { /** * The UUID of the EmployeeStateField this withholding applies to. */ employeeStateFieldUuid?: string | undefined; /** * Override mode. Only `one_time` is currently exposed. */ overrideType?: | PayrollUnprocessedEmployeeCompensationsTypeCustomWithholdingsOverrideType | undefined; /** * The amount that was withheld for this payroll. */ amount?: string | undefined; /** * How to interpret the amount. */ amountType?: | PayrollUnprocessedEmployeeCompensationsTypeCustomWithholdingsAmountType | undefined; }; /** * The one-time custom withholding overrides applied to this payroll for this employee. * * @remarks * `federal` is null when no federal one-time override is set; `state` is an empty * array when no state one-time overrides are set. */ export type PayrollUnprocessedEmployeeCompensationsTypeCustomWithholdings = { /** * Federal one-time custom withholding override applied to this payroll. */ federal?: | PayrollUnprocessedEmployeeCompensationsTypeFederal | null | undefined; /** * State one-time custom withholding overrides applied to this payroll, one entry per state field. */ state?: Array | undefined; }; export type PayrollUnprocessedEmployeeCompensationsType = { /** * The UUID of the employee. */ employeeUuid?: string | undefined; /** * This employee will be excluded (skipped) from payroll calculation and will not be paid for the payroll. Cancelling a payroll would reset all employees' excluded back to false. */ excluded?: boolean | undefined; /** * The first name of the employee. Requires `employees:read` scope. */ firstName?: string | null | undefined; /** * The preferred first name of the employee. Requires `employees:read` scope. */ preferredFirstName?: string | null | undefined; /** * The last name of the employee. Requires `employees:read` scope. */ lastName?: string | null | undefined; /** * The employee's gross pay, equal to regular wages + cash tips + payroll tips + any other additional earnings, excluding imputed income. This value is only available for processed payrolls. */ grossPay?: number | null | undefined; /** * The employee's net pay, equal to gross_pay - employee taxes - employee deductions or garnishments - cash tips. This value is only available for processed payrolls. */ netPay?: number | null | undefined; /** * The employee's check amount, equal to net_pay + reimbursements. This value is only available for processed payrolls. */ checkAmount?: number | null | undefined; /** * The employee's compensation payment method. Is *only* `Historical` when retrieving external payrolls initially run outside of Gusto, then put into Gusto. */ paymentMethod?: | PayrollUnprocessedEmployeeCompensationsTypePaymentMethod | null | undefined; /** * Custom text that will be printed as a personal note to the employee on a paystub. */ memo?: string | null | undefined; /** * An array of fixed compensations for the employee. Fixed compensations include tips, bonuses, and one time reimbursements. If this payroll has been processed, only fixed compensations with a value greater than 0.00 are returned. For an unprocessed payroll, all active fixed compensations are returned. */ fixedCompensations?: | Array | undefined; /** * An array of hourly compensations for the employee. Hourly compensations include regular, overtime, and double overtime hours. If this payroll has been processed, only hourly compensations with a value greater than 0.00 are returned. For an unprocessed payroll, all active hourly compensations are returned. */ hourlyCompensations?: | Array | undefined; /** * An array of all paid time off the employee is eligible for this pay period. */ paidTimeOff?: | Array | undefined; /** * An array of reimbursements for the employee. */ reimbursements?: | Array | undefined; /** * The one-time custom withholding overrides applied to this payroll for this employee. * * @remarks * `federal` is null when no federal one-time override is set; `state` is an empty * array when no state one-time overrides are set. */ customWithholdings?: | PayrollUnprocessedEmployeeCompensationsTypeCustomWithholdings | undefined; /** * The current version of this employee compensation. This field is only available for prepared payrolls. See the [versioning guide](https://docs.gusto.com/embedded-payroll/docs/api-fundamentals#optimistic-version-control) for information on how to use this field. */ version?: any | undefined; }; /** @internal */ export const PayrollUnprocessedEmployeeCompensationsTypePaymentMethod$inboundSchema: z.ZodNativeEnum< typeof PayrollUnprocessedEmployeeCompensationsTypePaymentMethod > = z.nativeEnum(PayrollUnprocessedEmployeeCompensationsTypePaymentMethod); /** @internal */ export const PayrollUnprocessedEmployeeCompensationsTypeFixedCompensations$inboundSchema: z.ZodType< PayrollUnprocessedEmployeeCompensationsTypeFixedCompensations, z.ZodTypeDef, unknown > = z.object({ name: z.string().optional(), amount: z.string().optional(), job_uuid: z.string().optional(), }).transform((v) => { return remap$(v, { "job_uuid": "jobUuid", }); }); export function payrollUnprocessedEmployeeCompensationsTypeFixedCompensationsFromJSON( jsonString: string, ): SafeParseResult< PayrollUnprocessedEmployeeCompensationsTypeFixedCompensations, SDKValidationError > { return safeParse( jsonString, (x) => PayrollUnprocessedEmployeeCompensationsTypeFixedCompensations$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'PayrollUnprocessedEmployeeCompensationsTypeFixedCompensations' from JSON`, ); } /** @internal */ export const PayrollUnprocessedEmployeeCompensationsTypeHourlyCompensations$inboundSchema: z.ZodType< PayrollUnprocessedEmployeeCompensationsTypeHourlyCompensations, z.ZodTypeDef, unknown > = z.object({ name: z.string().optional(), hours: z.string().optional(), amount: z.string().optional(), job_uuid: z.string().optional(), compensation_multiplier: z.number().optional(), flsa_status: z.string().optional(), }).transform((v) => { return remap$(v, { "job_uuid": "jobUuid", "compensation_multiplier": "compensationMultiplier", "flsa_status": "flsaStatus", }); }); export function payrollUnprocessedEmployeeCompensationsTypeHourlyCompensationsFromJSON( jsonString: string, ): SafeParseResult< PayrollUnprocessedEmployeeCompensationsTypeHourlyCompensations, SDKValidationError > { return safeParse( jsonString, (x) => PayrollUnprocessedEmployeeCompensationsTypeHourlyCompensations$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'PayrollUnprocessedEmployeeCompensationsTypeHourlyCompensations' from JSON`, ); } /** @internal */ export const PayrollUnprocessedEmployeeCompensationsTypePaidTimeOff$inboundSchema: z.ZodType< PayrollUnprocessedEmployeeCompensationsTypePaidTimeOff, z.ZodTypeDef, unknown > = z.object({ name: z.string().optional(), hours: z.string().optional(), final_payout_unused_hours_input: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "final_payout_unused_hours_input": "finalPayoutUnusedHoursInput", }); }); export function payrollUnprocessedEmployeeCompensationsTypePaidTimeOffFromJSON( jsonString: string, ): SafeParseResult< PayrollUnprocessedEmployeeCompensationsTypePaidTimeOff, SDKValidationError > { return safeParse( jsonString, (x) => PayrollUnprocessedEmployeeCompensationsTypePaidTimeOff$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'PayrollUnprocessedEmployeeCompensationsTypePaidTimeOff' from JSON`, ); } /** @internal */ export const PayrollUnprocessedEmployeeCompensationsTypeReimbursements$inboundSchema: z.ZodType< PayrollUnprocessedEmployeeCompensationsTypeReimbursements, z.ZodTypeDef, unknown > = z.object({ amount: z.string(), description: z.nullable(z.string()), uuid: z.nullable(z.string()).optional(), recurring: z.boolean().optional(), }); export function payrollUnprocessedEmployeeCompensationsTypeReimbursementsFromJSON( jsonString: string, ): SafeParseResult< PayrollUnprocessedEmployeeCompensationsTypeReimbursements, SDKValidationError > { return safeParse( jsonString, (x) => PayrollUnprocessedEmployeeCompensationsTypeReimbursements$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'PayrollUnprocessedEmployeeCompensationsTypeReimbursements' from JSON`, ); } /** @internal */ export const PayrollUnprocessedEmployeeCompensationsTypeOverrideType$inboundSchema: z.ZodNativeEnum< typeof PayrollUnprocessedEmployeeCompensationsTypeOverrideType > = z.nativeEnum(PayrollUnprocessedEmployeeCompensationsTypeOverrideType); /** @internal */ export const PayrollUnprocessedEmployeeCompensationsTypeAmountType$inboundSchema: z.ZodNativeEnum< typeof PayrollUnprocessedEmployeeCompensationsTypeAmountType > = z.nativeEnum(PayrollUnprocessedEmployeeCompensationsTypeAmountType); /** @internal */ export const PayrollUnprocessedEmployeeCompensationsTypeFederal$inboundSchema: z.ZodType< PayrollUnprocessedEmployeeCompensationsTypeFederal, z.ZodTypeDef, unknown > = z.object({ override_type: PayrollUnprocessedEmployeeCompensationsTypeOverrideType$inboundSchema .optional(), amount: z.string().optional(), amount_type: PayrollUnprocessedEmployeeCompensationsTypeAmountType$inboundSchema .optional(), }).transform((v) => { return remap$(v, { "override_type": "overrideType", "amount_type": "amountType", }); }); export function payrollUnprocessedEmployeeCompensationsTypeFederalFromJSON( jsonString: string, ): SafeParseResult< PayrollUnprocessedEmployeeCompensationsTypeFederal, SDKValidationError > { return safeParse( jsonString, (x) => PayrollUnprocessedEmployeeCompensationsTypeFederal$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'PayrollUnprocessedEmployeeCompensationsTypeFederal' from JSON`, ); } /** @internal */ export const PayrollUnprocessedEmployeeCompensationsTypeCustomWithholdingsOverrideType$inboundSchema: z.ZodNativeEnum< typeof PayrollUnprocessedEmployeeCompensationsTypeCustomWithholdingsOverrideType > = z.nativeEnum( PayrollUnprocessedEmployeeCompensationsTypeCustomWithholdingsOverrideType, ); /** @internal */ export const PayrollUnprocessedEmployeeCompensationsTypeCustomWithholdingsAmountType$inboundSchema: z.ZodNativeEnum< typeof PayrollUnprocessedEmployeeCompensationsTypeCustomWithholdingsAmountType > = z.nativeEnum( PayrollUnprocessedEmployeeCompensationsTypeCustomWithholdingsAmountType, ); /** @internal */ export const PayrollUnprocessedEmployeeCompensationsTypeState$inboundSchema: z.ZodType< PayrollUnprocessedEmployeeCompensationsTypeState, z.ZodTypeDef, unknown > = z.object({ employee_state_field_uuid: z.string().optional(), override_type: PayrollUnprocessedEmployeeCompensationsTypeCustomWithholdingsOverrideType$inboundSchema .optional(), amount: z.string().optional(), amount_type: PayrollUnprocessedEmployeeCompensationsTypeCustomWithholdingsAmountType$inboundSchema .optional(), }).transform((v) => { return remap$(v, { "employee_state_field_uuid": "employeeStateFieldUuid", "override_type": "overrideType", "amount_type": "amountType", }); }); export function payrollUnprocessedEmployeeCompensationsTypeStateFromJSON( jsonString: string, ): SafeParseResult< PayrollUnprocessedEmployeeCompensationsTypeState, SDKValidationError > { return safeParse( jsonString, (x) => PayrollUnprocessedEmployeeCompensationsTypeState$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'PayrollUnprocessedEmployeeCompensationsTypeState' from JSON`, ); } /** @internal */ export const PayrollUnprocessedEmployeeCompensationsTypeCustomWithholdings$inboundSchema: z.ZodType< PayrollUnprocessedEmployeeCompensationsTypeCustomWithholdings, z.ZodTypeDef, unknown > = z.object({ federal: z.nullable( z.lazy(() => PayrollUnprocessedEmployeeCompensationsTypeFederal$inboundSchema ), ).optional(), state: z.array( z.lazy(() => PayrollUnprocessedEmployeeCompensationsTypeState$inboundSchema ), ).optional(), }); export function payrollUnprocessedEmployeeCompensationsTypeCustomWithholdingsFromJSON( jsonString: string, ): SafeParseResult< PayrollUnprocessedEmployeeCompensationsTypeCustomWithholdings, SDKValidationError > { return safeParse( jsonString, (x) => PayrollUnprocessedEmployeeCompensationsTypeCustomWithholdings$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'PayrollUnprocessedEmployeeCompensationsTypeCustomWithholdings' from JSON`, ); } /** @internal */ export const PayrollUnprocessedEmployeeCompensationsType$inboundSchema: z.ZodType< PayrollUnprocessedEmployeeCompensationsType, z.ZodTypeDef, unknown > = z.object({ employee_uuid: z.string().optional(), excluded: z.boolean().optional(), first_name: z.nullable(z.string()).optional(), preferred_first_name: z.nullable(z.string()).optional(), last_name: z.nullable(z.string()).optional(), gross_pay: z.nullable(z.number()).optional(), net_pay: z.nullable(z.number()).optional(), check_amount: z.nullable(z.number()).optional(), payment_method: z.nullable( PayrollUnprocessedEmployeeCompensationsTypePaymentMethod$inboundSchema, ).optional(), memo: z.nullable(z.string()).optional(), fixed_compensations: z.array( z.lazy(() => PayrollUnprocessedEmployeeCompensationsTypeFixedCompensations$inboundSchema ), ).optional(), hourly_compensations: z.array( z.lazy(() => PayrollUnprocessedEmployeeCompensationsTypeHourlyCompensations$inboundSchema ), ).optional(), paid_time_off: z.array( z.lazy(() => PayrollUnprocessedEmployeeCompensationsTypePaidTimeOff$inboundSchema ), ).optional(), reimbursements: z.array( z.lazy(() => PayrollUnprocessedEmployeeCompensationsTypeReimbursements$inboundSchema ), ).optional(), custom_withholdings: z.lazy(() => PayrollUnprocessedEmployeeCompensationsTypeCustomWithholdings$inboundSchema ).optional(), version: z.any().optional(), }).transform((v) => { return remap$(v, { "employee_uuid": "employeeUuid", "first_name": "firstName", "preferred_first_name": "preferredFirstName", "last_name": "lastName", "gross_pay": "grossPay", "net_pay": "netPay", "check_amount": "checkAmount", "payment_method": "paymentMethod", "fixed_compensations": "fixedCompensations", "hourly_compensations": "hourlyCompensations", "paid_time_off": "paidTimeOff", "custom_withholdings": "customWithholdings", }); }); export function payrollUnprocessedEmployeeCompensationsTypeFromJSON( jsonString: string, ): SafeParseResult< PayrollUnprocessedEmployeeCompensationsType, SDKValidationError > { return safeParse( jsonString, (x) => PayrollUnprocessedEmployeeCompensationsType$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'PayrollUnprocessedEmployeeCompensationsType' from JSON`, ); }