/* * 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"; /** * The action being performed on the batch. */ export const BatchAction = { Create: "create", } as const; /** * The action being performed on the batch. */ export type BatchAction = ClosedEnum; /** * The lifecycle status of the batch request itself. Terminal values are `completed` (processing finished — inspect `results` and `exclusions` for per-company outcomes) and `failed` (request failed; can be retried). This is distinct from the per-company `status` returned inside `results[]` and `exclusions[]`. */ export const PayrollDigestStatus = { Pending: "pending", Processing: "processing", Completed: "completed", Failed: "failed", } as const; /** * The lifecycle status of the batch request itself. Terminal values are `completed` (processing finished — inspect `results` and `exclusions` for per-company outcomes) and `failed` (request failed; can be retried). This is distinct from the per-company `status` returned inside `results[]` and `exclusions[]`. */ export type PayrollDigestStatus = ClosedEnum; /** * A payroll digest batch request. */ export type PayrollDigest = { /** * The unique identifier of the payroll digest batch. */ uuid: string; /** * The idempotency key provided when creating the batch. */ idempotencyKey: string; /** * The action being performed on the batch. */ batchAction: BatchAction; /** * The lifecycle status of the batch request itself. Terminal values are `completed` (processing finished — inspect `results` and `exclusions` for per-company outcomes) and `failed` (request failed; can be retried). This is distinct from the per-company `status` returned inside `results[]` and `exclusions[]`. */ status: PayrollDigestStatus; }; /** @internal */ export const BatchAction$inboundSchema: z.ZodNativeEnum = z .nativeEnum(BatchAction); /** @internal */ export const PayrollDigestStatus$inboundSchema: z.ZodNativeEnum< typeof PayrollDigestStatus > = z.nativeEnum(PayrollDigestStatus); /** @internal */ export const PayrollDigest$inboundSchema: z.ZodType< PayrollDigest, z.ZodTypeDef, unknown > = z.object({ uuid: z.string(), idempotency_key: z.string(), batch_action: BatchAction$inboundSchema, status: PayrollDigestStatus$inboundSchema, }).transform((v) => { return remap$(v, { "idempotency_key": "idempotencyKey", "batch_action": "batchAction", }); }); export function payrollDigestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PayrollDigest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PayrollDigest' from JSON`, ); }