/* * 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 { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Whether the holder is an individual or a business. */ export const HolderType = { Consumer: "consumer", Business: "business", } as const; /** * Whether the holder is an individual or a business. */ export type HolderType = OpenEnum; /** * The holder's relationship to the account. */ export const HolderRelationship = { AuthorizedSigner: "authorized_signer", AuthorizedUser: "authorized_user", Business: "business", ForBenefitOf: "for_benefit_of", ForBenefitOfPrimary: "for_benefit_of_primary", ForBenefitOfPrimaryJointRestricted: "for_benefit_of_primary_joint_restricted", ForBenefitOfSecondary: "for_benefit_of_secondary", ForBenefitOfSecondaryJointRestricted: "for_benefit_of_secondary_joint_restricted", ForBenefitOfSoleOwnerRestricted: "for_benefit_of_sole_owner_restricted", PowerOfAttorney: "power_of_attorney", Primary: "primary", PrimaryBorrower: "primary_borrower", PrimaryJoint: "primary_joint", PrimaryJointTenants: "primary_joint_tenants", Secondary: "secondary", SecondaryBorrower: "secondary_borrower", SecondaryJoint: "secondary_joint", SecondaryJointTenants: "secondary_joint_tenants", SoleOwner: "sole_owner", Trustee: "trustee", UniformTransferToMinor: "uniform_transfer_to_minor", } as const; /** * The holder's relationship to the account. */ export type HolderRelationship = OpenEnum; /** * A person or business that holds the source bank account. Connectors that serve account contact data to a bank-feed consumer (`intuit-bank-feeds` and `plaid-exchange`) require each holder to carry `first_name` and `last_name`, or `business_name` when the holder is a business. */ export type BankFeedAccountHolder = { /** * Whether the holder is an individual or a business. */ type?: HolderType | undefined; /** * The holder's relationship to the account. */ relationship?: HolderRelationship | undefined; /** * The holder's first name. */ firstName?: string | undefined; /** * The holder's middle name. */ middleName?: string | undefined; /** * The holder's last name. */ lastName?: string | undefined; /** * The holder's name suffix. */ suffix?: string | undefined; /** * The legal name of a business holder. */ businessName?: string | undefined; }; /** @internal */ export const HolderType$inboundSchema: z.ZodType< HolderType, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(HolderType)); /** @internal */ export const HolderType$outboundSchema: z.ZodType< string, z.ZodTypeDef, HolderType > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(HolderType)); /** @internal */ export const HolderRelationship$inboundSchema: z.ZodType< HolderRelationship, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(HolderRelationship) ); /** @internal */ export const HolderRelationship$outboundSchema: z.ZodType< string, z.ZodTypeDef, HolderRelationship > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(HolderRelationship) ); /** @internal */ export const BankFeedAccountHolder$inboundSchema: z.ZodType< BankFeedAccountHolder, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ type: types.optional(HolderType$inboundSchema), relationship: types.optional(HolderRelationship$inboundSchema), first_name: types.optional(types.string()), middle_name: types.optional(types.string()), last_name: types.optional(types.string()), suffix: types.optional(types.string()), business_name: types.optional(types.string()), }).transform((v) => { return remap$(v, { "first_name": "firstName", "middle_name": "middleName", "last_name": "lastName", "business_name": "businessName", }); }) ); /** @internal */ export type BankFeedAccountHolder$Outbound = { type?: string | undefined; relationship?: string | undefined; first_name?: string | undefined; middle_name?: string | undefined; last_name?: string | undefined; suffix?: string | undefined; business_name?: string | undefined; }; /** @internal */ export const BankFeedAccountHolder$outboundSchema: z.ZodType< BankFeedAccountHolder$Outbound, z.ZodTypeDef, BankFeedAccountHolder > = /* @__PURE__ */ lazySchema$(() => z.object({ type: HolderType$outboundSchema.optional(), relationship: HolderRelationship$outboundSchema.optional(), firstName: z.string().optional(), middleName: z.string().optional(), lastName: z.string().optional(), suffix: z.string().optional(), businessName: z.string().optional(), }).transform((v) => { return remap$(v, { firstName: "first_name", middleName: "middle_name", lastName: "last_name", businessName: "business_name", }); }) ); export function bankFeedAccountHolderToJSON( bankFeedAccountHolder: BankFeedAccountHolder, ): string { return JSON.stringify( BankFeedAccountHolder$outboundSchema.parse(bankFeedAccountHolder), ); } export function bankFeedAccountHolderFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BankFeedAccountHolder$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BankFeedAccountHolder' from JSON`, ); }