/* * 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 { TaxIdKind, TaxIdKind$inboundSchema, TaxIdKind$outboundSchema, } from "./taxidkind.js"; export type TaxId = { /** * The tax ID for the buyer. */ value: string; kind: TaxIdKind; }; /** @internal */ export const TaxId$inboundSchema: z.ZodType = z .object({ value: z.string(), kind: TaxIdKind$inboundSchema, }); /** @internal */ export type TaxId$Outbound = { value: string; kind: string; }; /** @internal */ export const TaxId$outboundSchema: z.ZodType< TaxId$Outbound, z.ZodTypeDef, TaxId > = z.object({ value: z.string(), kind: TaxIdKind$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`, ); }