/* * 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"; export type Ein = { number: string; }; /** * An EIN (employer identification number) for the business. For sole proprietors, an SSN can be used as the EIN. */ export type TaxID = { ein: Ein; }; /** @internal */ export const Ein$inboundSchema: z.ZodType = z .object({ number: z.string(), }); /** @internal */ export type Ein$Outbound = { number: string; }; /** @internal */ export const Ein$outboundSchema: z.ZodType = z .object({ number: z.string(), }); export function einToJSON(ein: Ein): string { return JSON.stringify(Ein$outboundSchema.parse(ein)); } export function einFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Ein$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Ein' from JSON`, ); } /** @internal */ export const TaxID$inboundSchema: z.ZodType = z .object({ ein: z.lazy(() => Ein$inboundSchema), }); /** @internal */ export type TaxID$Outbound = { ein: Ein$Outbound; }; /** @internal */ export const TaxID$outboundSchema: z.ZodType< TaxID$Outbound, z.ZodTypeDef, TaxID > = z.object({ ein: z.lazy(() => Ein$outboundSchema), }); export function taxIDToJSON(taxID: TaxID): string { return JSON.stringify(TaxID$outboundSchema.parse(taxID)); } export function taxIDFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TaxID$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TaxID' from JSON`, ); }