/* * 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 const InformationRequestType = { CompanyOnboarding: "company_onboarding", AccountProtection: "account_protection", PaymentRequest: "payment_request", PaymentError: "payment_error", } as const; export type InformationRequestType = ClosedEnum; /** * The status of the information request */ export const InformationRequestStatus = { PendingResponse: "pending_response", PendingReview: "pending_review", Approved: "approved", } as const; /** * The status of the information request */ export type InformationRequestStatus = ClosedEnum< typeof InformationRequestStatus >; /** * The type of response to the question */ export const ResponseType = { Text: "text", Document: "document", Persona: "persona", RadioButton: "radio_button", } as const; /** * The type of response to the question */ export type ResponseType = ClosedEnum; export type RequiredQuestions = { /** * The UUID of the question */ questionUuid: string; /** * The text of the question */ questionText: string; /** * The type of response to the question */ responseType: ResponseType; }; /** * Representation of an information request */ export type InformationRequest = { /** * Unique identifier of an information request */ uuid?: string | undefined; /** * Unique identifier of the company to which the information requests belongs */ companyUuid?: string | undefined; /** * The type of information request */ type?: InformationRequestType | null | undefined; /** * The status of the information request */ status?: InformationRequestStatus | undefined; /** * If true, this information request is blocking payroll, and may require response or requires review from our Risk Ops team. */ blockingPayroll?: boolean | undefined; /** * The list of required questions for the information request */ requiredQuestions?: Array | undefined; }; /** @internal */ export const InformationRequestType$inboundSchema: z.ZodNativeEnum< typeof InformationRequestType > = z.nativeEnum(InformationRequestType); /** @internal */ export const InformationRequestStatus$inboundSchema: z.ZodNativeEnum< typeof InformationRequestStatus > = z.nativeEnum(InformationRequestStatus); /** @internal */ export const ResponseType$inboundSchema: z.ZodNativeEnum = z.nativeEnum(ResponseType); /** @internal */ export const RequiredQuestions$inboundSchema: z.ZodType< RequiredQuestions, z.ZodTypeDef, unknown > = z.object({ question_uuid: z.string(), question_text: z.string(), response_type: ResponseType$inboundSchema, }).transform((v) => { return remap$(v, { "question_uuid": "questionUuid", "question_text": "questionText", "response_type": "responseType", }); }); export function requiredQuestionsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RequiredQuestions$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RequiredQuestions' from JSON`, ); } /** @internal */ export const InformationRequest$inboundSchema: z.ZodType< InformationRequest, z.ZodTypeDef, unknown > = z.object({ uuid: z.string().optional(), company_uuid: z.string().optional(), type: z.nullable(InformationRequestType$inboundSchema).optional(), status: InformationRequestStatus$inboundSchema.optional(), blocking_payroll: z.boolean().optional(), required_questions: z.array(z.lazy(() => RequiredQuestions$inboundSchema)) .optional(), }).transform((v) => { return remap$(v, { "company_uuid": "companyUuid", "blocking_payroll": "blockingPayroll", "required_questions": "requiredQuestions", }); }); export function informationRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => InformationRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InformationRequest' from JSON`, ); }