/* * 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"; /** * The primary investment objective for the futures account */ export enum FuturesInvestmentObjective { FuturesInvestmentObjectiveUnspecified = "FUTURES_INVESTMENT_OBJECTIVE_UNSPECIFIED", Speculation = "SPECULATION", Hedging = "HEDGING", } /** * The primary investment objective for the futures account */ export type FuturesInvestmentObjectiveOpen = OpenEnum< typeof FuturesInvestmentObjective >; /** * Enrollment metadata for the FUTURES enrollment type */ export type FuturesEnrollmentMetadataCreate = { /** * Indicates whether the account is registered with the CFTC NFA */ ctfcNfaRegistered: boolean; /** * Indicates whether the account owner is a member of any exchanges */ exchangeMember: boolean; /** * Indicates whether the futures account is owned or controlled by a FCM */ fcmOwnedOrControlled: boolean; /** * Indicates whether the funds in the futures account are owned by the account owner */ fundsOwnedByAccountOwner: boolean; /** * Indicates whether the account owner has prior experience trading futures */ futuresExperience: boolean; /** * The primary investment objective for the futures account */ futuresInvestmentObjective: FuturesInvestmentObjectiveOpen; /** * Indicates whether the account will trade investment retired funds */ investmentRetiredFunds: boolean; /** * Indicates whether the account owner has experience with various trading options and strategies */ optionsExperience: boolean; /** * Indicates whether the account owner understands the risks associated with trading futures */ understandFuturesRisks: boolean; /** * Indicates whether the account owner understands that losses can exceed deposited funds */ understandLossBeyondFunds: boolean; }; /** @internal */ export const FuturesInvestmentObjective$inboundSchema: z.ZodType< FuturesInvestmentObjectiveOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(FuturesInvestmentObjective), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const FuturesInvestmentObjective$outboundSchema: z.ZodType< FuturesInvestmentObjectiveOpen, z.ZodTypeDef, FuturesInvestmentObjectiveOpen > = z.union([ z.nativeEnum(FuturesInvestmentObjective), 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 FuturesInvestmentObjective$ { /** @deprecated use `FuturesInvestmentObjective$inboundSchema` instead. */ export const inboundSchema = FuturesInvestmentObjective$inboundSchema; /** @deprecated use `FuturesInvestmentObjective$outboundSchema` instead. */ export const outboundSchema = FuturesInvestmentObjective$outboundSchema; } /** @internal */ export const FuturesEnrollmentMetadataCreate$inboundSchema: z.ZodType< FuturesEnrollmentMetadataCreate, z.ZodTypeDef, unknown > = z.object({ ctfc_nfa_registered: z.boolean(), exchange_member: z.boolean(), fcm_owned_or_controlled: z.boolean(), funds_owned_by_account_owner: z.boolean(), futures_experience: z.boolean(), futures_investment_objective: FuturesInvestmentObjective$inboundSchema, investment_retired_funds: z.boolean(), options_experience: z.boolean(), understand_futures_risks: z.boolean(), understand_loss_beyond_funds: z.boolean(), }).transform((v) => { return remap$(v, { "ctfc_nfa_registered": "ctfcNfaRegistered", "exchange_member": "exchangeMember", "fcm_owned_or_controlled": "fcmOwnedOrControlled", "funds_owned_by_account_owner": "fundsOwnedByAccountOwner", "futures_experience": "futuresExperience", "futures_investment_objective": "futuresInvestmentObjective", "investment_retired_funds": "investmentRetiredFunds", "options_experience": "optionsExperience", "understand_futures_risks": "understandFuturesRisks", "understand_loss_beyond_funds": "understandLossBeyondFunds", }); }); /** @internal */ export type FuturesEnrollmentMetadataCreate$Outbound = { ctfc_nfa_registered: boolean; exchange_member: boolean; fcm_owned_or_controlled: boolean; funds_owned_by_account_owner: boolean; futures_experience: boolean; futures_investment_objective: string; investment_retired_funds: boolean; options_experience: boolean; understand_futures_risks: boolean; understand_loss_beyond_funds: boolean; }; /** @internal */ export const FuturesEnrollmentMetadataCreate$outboundSchema: z.ZodType< FuturesEnrollmentMetadataCreate$Outbound, z.ZodTypeDef, FuturesEnrollmentMetadataCreate > = z.object({ ctfcNfaRegistered: z.boolean(), exchangeMember: z.boolean(), fcmOwnedOrControlled: z.boolean(), fundsOwnedByAccountOwner: z.boolean(), futuresExperience: z.boolean(), futuresInvestmentObjective: FuturesInvestmentObjective$outboundSchema, investmentRetiredFunds: z.boolean(), optionsExperience: z.boolean(), understandFuturesRisks: z.boolean(), understandLossBeyondFunds: z.boolean(), }).transform((v) => { return remap$(v, { ctfcNfaRegistered: "ctfc_nfa_registered", exchangeMember: "exchange_member", fcmOwnedOrControlled: "fcm_owned_or_controlled", fundsOwnedByAccountOwner: "funds_owned_by_account_owner", futuresExperience: "futures_experience", futuresInvestmentObjective: "futures_investment_objective", investmentRetiredFunds: "investment_retired_funds", optionsExperience: "options_experience", understandFuturesRisks: "understand_futures_risks", understandLossBeyondFunds: "understand_loss_beyond_funds", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace FuturesEnrollmentMetadataCreate$ { /** @deprecated use `FuturesEnrollmentMetadataCreate$inboundSchema` instead. */ export const inboundSchema = FuturesEnrollmentMetadataCreate$inboundSchema; /** @deprecated use `FuturesEnrollmentMetadataCreate$outboundSchema` instead. */ export const outboundSchema = FuturesEnrollmentMetadataCreate$outboundSchema; /** @deprecated use `FuturesEnrollmentMetadataCreate$Outbound` instead. */ export type Outbound = FuturesEnrollmentMetadataCreate$Outbound; } export function futuresEnrollmentMetadataCreateToJSON( futuresEnrollmentMetadataCreate: FuturesEnrollmentMetadataCreate, ): string { return JSON.stringify( FuturesEnrollmentMetadataCreate$outboundSchema.parse( futuresEnrollmentMetadataCreate, ), ); } export function futuresEnrollmentMetadataCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FuturesEnrollmentMetadataCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FuturesEnrollmentMetadataCreate' from JSON`, ); }