/* * 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 string identifier for each onboarding step */ export const Id = { AddAddresses: "add_addresses", FederalTaxSetup: "federal_tax_setup", SelectIndustry: "select_industry", AddBankInfo: "add_bank_info", AddEmployees: "add_employees", StateSetup: "state_setup", PayrollSchedule: "payroll_schedule", SignAllForms: "sign_all_forms", VerifyBankInfo: "verify_bank_info", ExternalPayroll: "external_payroll", } as const; /** * The string identifier for each onboarding step */ export type Id = ClosedEnum; export const CompanyOnboardingStatusRequirements = { AddAddresses: "add_addresses", FederalTaxSetup: "federal_tax_setup", SelectIndustry: "select_industry", AddBankInfo: "add_bank_info", AddEmployees: "add_employees", StateSetup: "state_setup", PayrollSchedule: "payroll_schedule", SignAllForms: "sign_all_forms", VerifyBankInfo: "verify_bank_info", ExternalPayroll: "external_payroll", } as const; export type CompanyOnboardingStatusRequirements = ClosedEnum< typeof CompanyOnboardingStatusRequirements >; export type OnboardingStep = { /** * The display name of the onboarding step */ title?: string | undefined; /** * The string identifier for each onboarding step */ id?: Id | undefined; /** * The boolean flag indicating whether the step is required or optional */ required?: boolean | undefined; /** * The boolean flag indicating whether the step is completed or not. */ completed?: boolean | undefined; /** * The ISO 8601 timestamp indicating when the onboarding step was completed. */ completedAt?: string | null | undefined; /** * The boolean flag indicating whether the step can be skipped or not. */ skippable?: boolean | undefined; /** * A list of onboarding steps that are required to be completed in order to proceed with the current onboarding step. */ requirements?: Array | undefined; }; /** * The representation of a company's onboarding status */ export type CompanyOnboardingStatus = { /** * the UUID of the company */ uuid: string; /** * a boolean flag for the company's onboarding status */ onboardingCompleted?: boolean | undefined; /** * a list of company onboarding steps */ onboardingSteps?: Array | undefined; }; /** @internal */ export const Id$inboundSchema: z.ZodNativeEnum = z.nativeEnum(Id); /** @internal */ export const CompanyOnboardingStatusRequirements$inboundSchema: z.ZodNativeEnum< typeof CompanyOnboardingStatusRequirements > = z.nativeEnum(CompanyOnboardingStatusRequirements); /** @internal */ export const OnboardingStep$inboundSchema: z.ZodType< OnboardingStep, z.ZodTypeDef, unknown > = z.object({ title: z.string().optional(), id: Id$inboundSchema.optional(), required: z.boolean().optional(), completed: z.boolean().optional(), completed_at: z.nullable(z.string()).optional(), skippable: z.boolean().optional(), requirements: z.array(CompanyOnboardingStatusRequirements$inboundSchema) .optional(), }).transform((v) => { return remap$(v, { "completed_at": "completedAt", }); }); export function onboardingStepFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OnboardingStep$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OnboardingStep' from JSON`, ); } /** @internal */ export const CompanyOnboardingStatus$inboundSchema: z.ZodType< CompanyOnboardingStatus, z.ZodTypeDef, unknown > = z.object({ uuid: z.string(), onboarding_completed: z.boolean().optional(), onboarding_steps: z.array(z.lazy(() => OnboardingStep$inboundSchema)) .optional(), }).transform((v) => { return remap$(v, { "onboarding_completed": "onboardingCompleted", "onboarding_steps": "onboardingSteps", }); }); export function companyOnboardingStatusFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CompanyOnboardingStatus$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CompanyOnboardingStatus' from JSON`, ); }