/* * 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"; /** * Whether it is regular pay period or transition pay period. */ export const PayrollType = { Regular: "regular", Transition: "transition", } as const; /** * Whether it is regular pay period or transition pay period. */ export type PayrollType = ClosedEnum; /** * Information about the payroll for the pay period. */ export type PayPeriodPayroll = { /** * The UUID of the payroll for this pay period. */ payrollUuid?: string | undefined; /** * The date on which employees will be paid for the payroll if the payroll is submitted on time. */ checkDate?: string | undefined; /** * Whether or not the payroll has been successfully processed. Note that processed payrolls cannot be updated. Additionally, a payroll is not guaranteed to be processed just because the payroll deadline has passed. Late payrolls are not uncommon. Conversely, users may choose to run payroll before the payroll deadline. */ processed?: boolean | undefined; /** * The date by which payroll should be run for employees to be paid on time. Payroll data, such as time and attendance data, should be submitted on or before this date. */ payrollDeadline?: Date | undefined; /** * Whether it is regular pay period or transition pay period. */ payrollType?: PayrollType | undefined; }; /** * The representation of a pay period. */ export type PayPeriod = { /** * The start date, inclusive, of the pay period. */ startDate?: string | undefined; /** * The end date, inclusive, of the pay period. */ endDate?: string | undefined; /** * A unique identifier of the pay schedule to which the pay period belongs. */ payScheduleUuid?: string | undefined; /** * Information about the payroll for the pay period. */ payroll?: PayPeriodPayroll | undefined; }; /** @internal */ export const PayrollType$inboundSchema: z.ZodNativeEnum = z .nativeEnum(PayrollType); /** @internal */ export const PayPeriodPayroll$inboundSchema: z.ZodType< PayPeriodPayroll, z.ZodTypeDef, unknown > = z.object({ payroll_uuid: z.string().optional(), check_date: z.string().optional(), processed: z.boolean().optional(), payroll_deadline: z.string().datetime({ offset: true }).transform(v => new Date(v) ).optional(), payroll_type: PayrollType$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "payroll_uuid": "payrollUuid", "check_date": "checkDate", "payroll_deadline": "payrollDeadline", "payroll_type": "payrollType", }); }); export function payPeriodPayrollFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PayPeriodPayroll$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PayPeriodPayroll' from JSON`, ); } /** @internal */ export const PayPeriod$inboundSchema: z.ZodType< PayPeriod, z.ZodTypeDef, unknown > = z.object({ start_date: z.string().optional(), end_date: z.string().optional(), pay_schedule_uuid: z.string().optional(), payroll: z.lazy(() => PayPeriodPayroll$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "start_date": "startDate", "end_date": "endDate", "pay_schedule_uuid": "payScheduleUuid", }); }); export function payPeriodFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PayPeriod$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PayPeriod' from JSON`, ); }