/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { catchUnrecognizedEnum, OpenEnum, Unrecognized, } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Federal tax classification. */ export enum FederalTaxClassification { FederalTaxClassificationUnspecified = "FEDERAL_TAX_CLASSIFICATION_UNSPECIFIED", IndivSolepropOrSinglememberllc = "INDIV_SOLEPROP_OR_SINGLEMEMBERLLC", CCorporation = "C_CORPORATION", SCorporation = "S_CORPORATION", TrustEstate = "TRUST_ESTATE", LlcTaxedAsCCorp = "LLC_TAXED_AS_C_CORP", LlcTaxedAsSCorp = "LLC_TAXED_AS_S_CORP", LlcTaxedAsPartnership = "LLC_TAXED_AS_PARTNERSHIP", Other = "OTHER", } /** * Federal tax classification. */ export type FederalTaxClassificationOpen = OpenEnum< typeof FederalTaxClassification >; /** * IRS form type. */ export enum IrsFormType { IrsFormTypeUnspecified = "IRS_FORM_TYPE_UNSPECIFIED", W9 = "W_9", W8Ben = "W_8BEN", } /** * IRS form type. */ export type IrsFormTypeOpen = OpenEnum; /** * United States Individual Taxpayer Identification Number (ITIN) status. */ export enum UsTinStatus { UsTinStatusUnspecified = "US_TIN_STATUS_UNSPECIFIED", Passing = "PASSING", Failing = "FAILING", } /** * United States Individual Taxpayer Identification Number (ITIN) status. */ export type UsTinStatusOpen = OpenEnum; /** * Tax Profile pertaining to the Legal Entity or Natural Person. */ export type TaxProfileCreate = { /** * Federal tax classification. */ federalTaxClassification: FederalTaxClassificationOpen; /** * IRS form type. */ irsFormType: IrsFormTypeOpen; /** * Legal tax region must be "US" if provided W-9, otherwise must be a non-US country. */ legalTaxRegionCode: string; /** * United States Individual Taxpayer Identification Number (ITIN) status. */ usTinStatus: UsTinStatusOpen; }; /** @internal */ export const FederalTaxClassification$inboundSchema: z.ZodType< FederalTaxClassificationOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(FederalTaxClassification), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const FederalTaxClassification$outboundSchema: z.ZodType< FederalTaxClassificationOpen, z.ZodTypeDef, FederalTaxClassificationOpen > = z.union([ z.nativeEnum(FederalTaxClassification), z.string().and(z.custom>()), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace FederalTaxClassification$ { /** @deprecated use `FederalTaxClassification$inboundSchema` instead. */ export const inboundSchema = FederalTaxClassification$inboundSchema; /** @deprecated use `FederalTaxClassification$outboundSchema` instead. */ export const outboundSchema = FederalTaxClassification$outboundSchema; } /** @internal */ export const IrsFormType$inboundSchema: z.ZodType< IrsFormTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(IrsFormType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const IrsFormType$outboundSchema: z.ZodType< IrsFormTypeOpen, z.ZodTypeDef, IrsFormTypeOpen > = z.union([ z.nativeEnum(IrsFormType), z.string().and(z.custom>()), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace IrsFormType$ { /** @deprecated use `IrsFormType$inboundSchema` instead. */ export const inboundSchema = IrsFormType$inboundSchema; /** @deprecated use `IrsFormType$outboundSchema` instead. */ export const outboundSchema = IrsFormType$outboundSchema; } /** @internal */ export const UsTinStatus$inboundSchema: z.ZodType< UsTinStatusOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(UsTinStatus), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const UsTinStatus$outboundSchema: z.ZodType< UsTinStatusOpen, z.ZodTypeDef, UsTinStatusOpen > = z.union([ z.nativeEnum(UsTinStatus), z.string().and(z.custom>()), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace UsTinStatus$ { /** @deprecated use `UsTinStatus$inboundSchema` instead. */ export const inboundSchema = UsTinStatus$inboundSchema; /** @deprecated use `UsTinStatus$outboundSchema` instead. */ export const outboundSchema = UsTinStatus$outboundSchema; } /** @internal */ export const TaxProfileCreate$inboundSchema: z.ZodType< TaxProfileCreate, z.ZodTypeDef, unknown > = z.object({ federal_tax_classification: FederalTaxClassification$inboundSchema, irs_form_type: IrsFormType$inboundSchema, legal_tax_region_code: z.string(), us_tin_status: UsTinStatus$inboundSchema, }).transform((v) => { return remap$(v, { "federal_tax_classification": "federalTaxClassification", "irs_form_type": "irsFormType", "legal_tax_region_code": "legalTaxRegionCode", "us_tin_status": "usTinStatus", }); }); /** @internal */ export type TaxProfileCreate$Outbound = { federal_tax_classification: string; irs_form_type: string; legal_tax_region_code: string; us_tin_status: string; }; /** @internal */ export const TaxProfileCreate$outboundSchema: z.ZodType< TaxProfileCreate$Outbound, z.ZodTypeDef, TaxProfileCreate > = z.object({ federalTaxClassification: FederalTaxClassification$outboundSchema, irsFormType: IrsFormType$outboundSchema, legalTaxRegionCode: z.string(), usTinStatus: UsTinStatus$outboundSchema, }).transform((v) => { return remap$(v, { federalTaxClassification: "federal_tax_classification", irsFormType: "irs_form_type", legalTaxRegionCode: "legal_tax_region_code", usTinStatus: "us_tin_status", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace TaxProfileCreate$ { /** @deprecated use `TaxProfileCreate$inboundSchema` instead. */ export const inboundSchema = TaxProfileCreate$inboundSchema; /** @deprecated use `TaxProfileCreate$outboundSchema` instead. */ export const outboundSchema = TaxProfileCreate$outboundSchema; /** @deprecated use `TaxProfileCreate$Outbound` instead. */ export type Outbound = TaxProfileCreate$Outbound; } export function taxProfileCreateToJSON( taxProfileCreate: TaxProfileCreate, ): string { return JSON.stringify( TaxProfileCreate$outboundSchema.parse(taxProfileCreate), ); } export function taxProfileCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TaxProfileCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TaxProfileCreate' from JSON`, ); }