/* * 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 type EmployeeOnboardingStatusOnboardingStep = { /** * User-friendly description of the onboarding step. */ title?: string | undefined; /** * String identifier for the onboarding step. */ id?: string | undefined; /** * When true, this step is required. */ required?: boolean | undefined; /** * When true, this step has been completed. */ completed?: boolean | undefined; /** * A list of onboarding steps required to begin this step. */ requirements?: Array | undefined; }; /** * The employee field affected. */ export const Field = { Ssn: "ssn", } as const; /** * The employee field affected. */ export type Field = ClosedEnum; /** * Category of the blocker. See the array-level description for resolution guidance. */ export const EmployeeOnboardingStatusCategory = { DuplicateValue: "duplicate_value", } as const; /** * Category of the blocker. See the array-level description for resolution guidance. */ export type EmployeeOnboardingStatusCategory = ClosedEnum< typeof EmployeeOnboardingStatusCategory >; export type Blockers = { /** * The employee field affected. */ field?: Field | undefined; /** * Category of the blocker. See the array-level description for resolution guidance. */ category?: EmployeeOnboardingStatusCategory | undefined; /** * Human-readable description of the blocker. */ message?: string | undefined; }; /** * The representation of an employee's onboarding status. */ export type EmployeeOnboardingStatus = { /** * Unique identifier for this employee. */ uuid: string; /** * One of the "onboarding_status" enum values. */ onboardingStatus?: string | undefined; /** * List of steps required to onboard an employee. */ onboardingSteps?: Array | undefined; /** * Validation issues that should be resolved before this employee's onboarding is complete. Each entry identifies an affected field, a category describing the type of problem, and a human-readable message. * * @remarks * * Supported categories: * * - `duplicate_value`: Another employee in the same company already has this value. To resolve, cancel this onboarding and initiate a rehire if it's a returning employee, or contact support to investigate the conflict. * * This list may grow over time as new validation rules are added. */ blockers?: Array | undefined; }; /** @internal */ export const EmployeeOnboardingStatusOnboardingStep$inboundSchema: z.ZodType< EmployeeOnboardingStatusOnboardingStep, z.ZodTypeDef, unknown > = z.object({ title: z.string().optional(), id: z.string().optional(), required: z.boolean().optional(), completed: z.boolean().optional(), requirements: z.array(z.string()).optional(), }); export function employeeOnboardingStatusOnboardingStepFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EmployeeOnboardingStatusOnboardingStep$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EmployeeOnboardingStatusOnboardingStep' from JSON`, ); } /** @internal */ export const Field$inboundSchema: z.ZodNativeEnum = z.nativeEnum( Field, ); /** @internal */ export const EmployeeOnboardingStatusCategory$inboundSchema: z.ZodNativeEnum< typeof EmployeeOnboardingStatusCategory > = z.nativeEnum(EmployeeOnboardingStatusCategory); /** @internal */ export const Blockers$inboundSchema: z.ZodType< Blockers, z.ZodTypeDef, unknown > = z.object({ field: Field$inboundSchema.optional(), category: EmployeeOnboardingStatusCategory$inboundSchema.optional(), message: z.string().optional(), }); export function blockersFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Blockers$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Blockers' from JSON`, ); } /** @internal */ export const EmployeeOnboardingStatus$inboundSchema: z.ZodType< EmployeeOnboardingStatus, z.ZodTypeDef, unknown > = z.object({ uuid: z.string(), onboarding_status: z.string().optional(), onboarding_steps: z.array( z.lazy(() => EmployeeOnboardingStatusOnboardingStep$inboundSchema), ).optional(), blockers: z.array(z.lazy(() => Blockers$inboundSchema)).optional(), }).transform((v) => { return remap$(v, { "onboarding_status": "onboardingStatus", "onboarding_steps": "onboardingSteps", }); }); export function employeeOnboardingStatusFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EmployeeOnboardingStatus$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EmployeeOnboardingStatus' from JSON`, ); }