/* * 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 = { Cancel: "cancel", } 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-payroll outcomes) and `failed` (the batch crashed at the system level; can be retried). This is distinct from the per-payroll `status` returned inside `results[]`. A `completed` batch does not imply every payroll was cancelled. */ export const PayrollBatchStatus = { 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-payroll outcomes) and `failed` (the batch crashed at the system level; can be retried). This is distinct from the per-payroll `status` returned inside `results[]`. A `completed` batch does not imply every payroll was cancelled. */ export type PayrollBatchStatus = ClosedEnum; /** * A payroll cancellation batch request. */ export type PayrollBatch = { /** * The unique identifier of the payroll cancellation 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-payroll outcomes) and `failed` (the batch crashed at the system level; can be retried). This is distinct from the per-payroll `status` returned inside `results[]`. A `completed` batch does not imply every payroll was cancelled. */ status: PayrollBatchStatus; }; /** @internal */ export const BatchAction$inboundSchema: z.ZodNativeEnum = z .nativeEnum(BatchAction); /** @internal */ export const PayrollBatchStatus$inboundSchema: z.ZodNativeEnum< typeof PayrollBatchStatus > = z.nativeEnum(PayrollBatchStatus); /** @internal */ export const PayrollBatch$inboundSchema: z.ZodType< PayrollBatch, z.ZodTypeDef, unknown > = z.object({ uuid: z.string(), idempotency_key: z.string(), batch_action: BatchAction$inboundSchema, status: PayrollBatchStatus$inboundSchema, }).transform((v) => { return remap$(v, { "idempotency_key": "idempotencyKey", "batch_action": "batchAction", }); }); export function payrollBatchFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PayrollBatch$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PayrollBatch' from JSON`, ); }