/* * 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"; import { ForeignBondTradingDetailsCreate, ForeignBondTradingDetailsCreate$inboundSchema, ForeignBondTradingDetailsCreate$Outbound, ForeignBondTradingDetailsCreate$outboundSchema, } from "./foreignbondtradingdetailscreate.js"; import { LowPricedSecuritiesCreate, LowPricedSecuritiesCreate$inboundSchema, LowPricedSecuritiesCreate$Outbound, LowPricedSecuritiesCreate$outboundSchema, } from "./lowpricedsecuritiescreate.js"; /** * The primary account activity type */ export enum PrimaryAccountActivityType { PrimaryAccountActivityTypeUnspecified = "PRIMARY_ACCOUNT_ACTIVITY_TYPE_UNSPECIFIED", ActiveTrading = "ACTIVE_TRADING", ShortTermInvesting = "SHORT_TERM_INVESTING", LongTermInvesting = "LONG_TERM_INVESTING", } /** * The primary account activity type */ export type PrimaryAccountActivityTypeOpen = OpenEnum< typeof PrimaryAccountActivityType >; /** * The frequency by which cash is anticipated to be withdrawn from the account */ export enum WithdrawalFrequency { WithdrawalFrequencyUnspecified = "WITHDRAWAL_FREQUENCY_UNSPECIFIED", Frequent = "FREQUENT", Occasional = "OCCASIONAL", Rare = "RARE", } /** * The frequency by which cash is anticipated to be withdrawn from the account */ export type WithdrawalFrequencyOpen = OpenEnum; /** * Details the customer's intended trading and banking-related activities at the time of account application; informs risk checks and forms a baseline for anomalous activity detection */ export type PlannedActivityCreate = { /** * Foreign bond trading detail */ foreignBondTradingDetails: ForeignBondTradingDetailsCreate; /** * Low priced securities */ lowPricedSecurities: LowPricedSecuritiesCreate; /** * The primary account activity type */ primaryAccountActivityType: PrimaryAccountActivityTypeOpen; /** * The frequency by which cash is anticipated to be withdrawn from the account */ withdrawalFrequency: WithdrawalFrequencyOpen; }; /** @internal */ export const PrimaryAccountActivityType$inboundSchema: z.ZodType< PrimaryAccountActivityTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(PrimaryAccountActivityType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const PrimaryAccountActivityType$outboundSchema: z.ZodType< PrimaryAccountActivityTypeOpen, z.ZodTypeDef, PrimaryAccountActivityTypeOpen > = z.union([ z.nativeEnum(PrimaryAccountActivityType), 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 PrimaryAccountActivityType$ { /** @deprecated use `PrimaryAccountActivityType$inboundSchema` instead. */ export const inboundSchema = PrimaryAccountActivityType$inboundSchema; /** @deprecated use `PrimaryAccountActivityType$outboundSchema` instead. */ export const outboundSchema = PrimaryAccountActivityType$outboundSchema; } /** @internal */ export const WithdrawalFrequency$inboundSchema: z.ZodType< WithdrawalFrequencyOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(WithdrawalFrequency), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const WithdrawalFrequency$outboundSchema: z.ZodType< WithdrawalFrequencyOpen, z.ZodTypeDef, WithdrawalFrequencyOpen > = z.union([ z.nativeEnum(WithdrawalFrequency), 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 WithdrawalFrequency$ { /** @deprecated use `WithdrawalFrequency$inboundSchema` instead. */ export const inboundSchema = WithdrawalFrequency$inboundSchema; /** @deprecated use `WithdrawalFrequency$outboundSchema` instead. */ export const outboundSchema = WithdrawalFrequency$outboundSchema; } /** @internal */ export const PlannedActivityCreate$inboundSchema: z.ZodType< PlannedActivityCreate, z.ZodTypeDef, unknown > = z.object({ foreign_bond_trading_details: ForeignBondTradingDetailsCreate$inboundSchema, low_priced_securities: LowPricedSecuritiesCreate$inboundSchema, primary_account_activity_type: PrimaryAccountActivityType$inboundSchema, withdrawal_frequency: WithdrawalFrequency$inboundSchema, }).transform((v) => { return remap$(v, { "foreign_bond_trading_details": "foreignBondTradingDetails", "low_priced_securities": "lowPricedSecurities", "primary_account_activity_type": "primaryAccountActivityType", "withdrawal_frequency": "withdrawalFrequency", }); }); /** @internal */ export type PlannedActivityCreate$Outbound = { foreign_bond_trading_details: ForeignBondTradingDetailsCreate$Outbound; low_priced_securities: LowPricedSecuritiesCreate$Outbound; primary_account_activity_type: string; withdrawal_frequency: string; }; /** @internal */ export const PlannedActivityCreate$outboundSchema: z.ZodType< PlannedActivityCreate$Outbound, z.ZodTypeDef, PlannedActivityCreate > = z.object({ foreignBondTradingDetails: ForeignBondTradingDetailsCreate$outboundSchema, lowPricedSecurities: LowPricedSecuritiesCreate$outboundSchema, primaryAccountActivityType: PrimaryAccountActivityType$outboundSchema, withdrawalFrequency: WithdrawalFrequency$outboundSchema, }).transform((v) => { return remap$(v, { foreignBondTradingDetails: "foreign_bond_trading_details", lowPricedSecurities: "low_priced_securities", primaryAccountActivityType: "primary_account_activity_type", withdrawalFrequency: "withdrawal_frequency", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PlannedActivityCreate$ { /** @deprecated use `PlannedActivityCreate$inboundSchema` instead. */ export const inboundSchema = PlannedActivityCreate$inboundSchema; /** @deprecated use `PlannedActivityCreate$outboundSchema` instead. */ export const outboundSchema = PlannedActivityCreate$outboundSchema; /** @deprecated use `PlannedActivityCreate$Outbound` instead. */ export type Outbound = PlannedActivityCreate$Outbound; } export function plannedActivityCreateToJSON( plannedActivityCreate: PlannedActivityCreate, ): string { return JSON.stringify( PlannedActivityCreate$outboundSchema.parse(plannedActivityCreate), ); } export function plannedActivityCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PlannedActivityCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PlannedActivityCreate' from JSON`, ); }