/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AddressError, AddressError$inboundSchema, AddressError$Outbound, AddressError$outboundSchema, } from "./addresserror.js"; import { PhoneNumberError, PhoneNumberError$inboundSchema, PhoneNumberError$Outbound, PhoneNumberError$outboundSchema, } from "./phonenumbererror.js"; export type CreateBusinessErrorEin = { number?: string | undefined; }; export type CreateBusinessErrorTaxID = { ein?: CreateBusinessErrorEin | undefined; }; export type CreateBusinessErrorIndustryCodes = { naics?: string | undefined; sic?: string | undefined; mcc?: string | undefined; }; export type CreateBusinessError = { legalBusinessName?: string | undefined; doingBusinessAs?: string | undefined; businessType?: string | undefined; address?: AddressError | undefined; phone?: PhoneNumberError | undefined; email?: string | undefined; website?: string | undefined; description?: string | undefined; taxID?: CreateBusinessErrorTaxID | undefined; industryCodes?: CreateBusinessErrorIndustryCodes | undefined; /** * Classification identifier for the industry. Use the [GET industries](https://docs.moov.io/api/enrichment/form-shortening/industries/get/) endpoint to retrieve an array of valid industry details for a merchant, inducing all industry field values. */ industry?: string | undefined; primaryRegulator?: string | undefined; }; /** @internal */ export const CreateBusinessErrorEin$inboundSchema: z.ZodType< CreateBusinessErrorEin, z.ZodTypeDef, unknown > = z.object({ number: z.string().optional(), }); /** @internal */ export type CreateBusinessErrorEin$Outbound = { number?: string | undefined; }; /** @internal */ export const CreateBusinessErrorEin$outboundSchema: z.ZodType< CreateBusinessErrorEin$Outbound, z.ZodTypeDef, CreateBusinessErrorEin > = z.object({ number: z.string().optional(), }); export function createBusinessErrorEinToJSON( createBusinessErrorEin: CreateBusinessErrorEin, ): string { return JSON.stringify( CreateBusinessErrorEin$outboundSchema.parse(createBusinessErrorEin), ); } export function createBusinessErrorEinFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateBusinessErrorEin$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateBusinessErrorEin' from JSON`, ); } /** @internal */ export const CreateBusinessErrorTaxID$inboundSchema: z.ZodType< CreateBusinessErrorTaxID, z.ZodTypeDef, unknown > = z.object({ ein: z.lazy(() => CreateBusinessErrorEin$inboundSchema).optional(), }); /** @internal */ export type CreateBusinessErrorTaxID$Outbound = { ein?: CreateBusinessErrorEin$Outbound | undefined; }; /** @internal */ export const CreateBusinessErrorTaxID$outboundSchema: z.ZodType< CreateBusinessErrorTaxID$Outbound, z.ZodTypeDef, CreateBusinessErrorTaxID > = z.object({ ein: z.lazy(() => CreateBusinessErrorEin$outboundSchema).optional(), }); export function createBusinessErrorTaxIDToJSON( createBusinessErrorTaxID: CreateBusinessErrorTaxID, ): string { return JSON.stringify( CreateBusinessErrorTaxID$outboundSchema.parse(createBusinessErrorTaxID), ); } export function createBusinessErrorTaxIDFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateBusinessErrorTaxID$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateBusinessErrorTaxID' from JSON`, ); } /** @internal */ export const CreateBusinessErrorIndustryCodes$inboundSchema: z.ZodType< CreateBusinessErrorIndustryCodes, z.ZodTypeDef, unknown > = z.object({ naics: z.string().optional(), sic: z.string().optional(), mcc: z.string().optional(), }); /** @internal */ export type CreateBusinessErrorIndustryCodes$Outbound = { naics?: string | undefined; sic?: string | undefined; mcc?: string | undefined; }; /** @internal */ export const CreateBusinessErrorIndustryCodes$outboundSchema: z.ZodType< CreateBusinessErrorIndustryCodes$Outbound, z.ZodTypeDef, CreateBusinessErrorIndustryCodes > = z.object({ naics: z.string().optional(), sic: z.string().optional(), mcc: z.string().optional(), }); export function createBusinessErrorIndustryCodesToJSON( createBusinessErrorIndustryCodes: CreateBusinessErrorIndustryCodes, ): string { return JSON.stringify( CreateBusinessErrorIndustryCodes$outboundSchema.parse( createBusinessErrorIndustryCodes, ), ); } export function createBusinessErrorIndustryCodesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateBusinessErrorIndustryCodes$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateBusinessErrorIndustryCodes' from JSON`, ); } /** @internal */ export const CreateBusinessError$inboundSchema: z.ZodType< CreateBusinessError, z.ZodTypeDef, unknown > = z.object({ legalBusinessName: z.string().optional(), doingBusinessAs: z.string().optional(), businessType: z.string().optional(), address: AddressError$inboundSchema.optional(), phone: PhoneNumberError$inboundSchema.optional(), email: z.string().optional(), website: z.string().optional(), description: z.string().optional(), taxID: z.lazy(() => CreateBusinessErrorTaxID$inboundSchema).optional(), industryCodes: z.lazy(() => CreateBusinessErrorIndustryCodes$inboundSchema) .optional(), industry: z.string().optional(), primaryRegulator: z.string().optional(), }); /** @internal */ export type CreateBusinessError$Outbound = { legalBusinessName?: string | undefined; doingBusinessAs?: string | undefined; businessType?: string | undefined; address?: AddressError$Outbound | undefined; phone?: PhoneNumberError$Outbound | undefined; email?: string | undefined; website?: string | undefined; description?: string | undefined; taxID?: CreateBusinessErrorTaxID$Outbound | undefined; industryCodes?: CreateBusinessErrorIndustryCodes$Outbound | undefined; industry?: string | undefined; primaryRegulator?: string | undefined; }; /** @internal */ export const CreateBusinessError$outboundSchema: z.ZodType< CreateBusinessError$Outbound, z.ZodTypeDef, CreateBusinessError > = z.object({ legalBusinessName: z.string().optional(), doingBusinessAs: z.string().optional(), businessType: z.string().optional(), address: AddressError$outboundSchema.optional(), phone: PhoneNumberError$outboundSchema.optional(), email: z.string().optional(), website: z.string().optional(), description: z.string().optional(), taxID: z.lazy(() => CreateBusinessErrorTaxID$outboundSchema).optional(), industryCodes: z.lazy(() => CreateBusinessErrorIndustryCodes$outboundSchema) .optional(), industry: z.string().optional(), primaryRegulator: z.string().optional(), }); export function createBusinessErrorToJSON( createBusinessError: CreateBusinessError, ): string { return JSON.stringify( CreateBusinessError$outboundSchema.parse(createBusinessError), ); } export function createBusinessErrorFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateBusinessError$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateBusinessError' from JSON`, ); }