/* * 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 { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * The percentage of the account's trades which will involve foreign bond */ export type Percentage = { /** * The decimal value, as a string; Refer to [Google’s Decimal type protocol buffer](https://github.com/googleapis/googleapis/blob/40203ca1880849480bbff7b8715491060bbccdf1/google/type/decimal.proto#L33) for details */ value?: string | undefined; }; /** * Foreign bond trading detail */ export type ForeignBondTradingDetail = { /** * The percentage of the account's trades which will involve foreign bond */ percentage?: Percentage | null | undefined; /** * The region where the foreign bond trading activity is taking place. Must be a two-character CLDR code. */ regionCode?: string | undefined; }; /** @internal */ export const Percentage$inboundSchema: z.ZodType< Percentage, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type Percentage$Outbound = { value?: string | undefined; }; /** @internal */ export const Percentage$outboundSchema: z.ZodType< Percentage$Outbound, z.ZodTypeDef, Percentage > = z.object({ value: z.string().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Percentage$ { /** @deprecated use `Percentage$inboundSchema` instead. */ export const inboundSchema = Percentage$inboundSchema; /** @deprecated use `Percentage$outboundSchema` instead. */ export const outboundSchema = Percentage$outboundSchema; /** @deprecated use `Percentage$Outbound` instead. */ export type Outbound = Percentage$Outbound; } export function percentageToJSON(percentage: Percentage): string { return JSON.stringify(Percentage$outboundSchema.parse(percentage)); } export function percentageFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Percentage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Percentage' from JSON`, ); } /** @internal */ export const ForeignBondTradingDetail$inboundSchema: z.ZodType< ForeignBondTradingDetail, z.ZodTypeDef, unknown > = z.object({ percentage: z.nullable(z.lazy(() => Percentage$inboundSchema)).optional(), region_code: z.string().optional(), }).transform((v) => { return remap$(v, { "region_code": "regionCode", }); }); /** @internal */ export type ForeignBondTradingDetail$Outbound = { percentage?: Percentage$Outbound | null | undefined; region_code?: string | undefined; }; /** @internal */ export const ForeignBondTradingDetail$outboundSchema: z.ZodType< ForeignBondTradingDetail$Outbound, z.ZodTypeDef, ForeignBondTradingDetail > = z.object({ percentage: z.nullable(z.lazy(() => Percentage$outboundSchema)).optional(), regionCode: z.string().optional(), }).transform((v) => { return remap$(v, { regionCode: "region_code", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ForeignBondTradingDetail$ { /** @deprecated use `ForeignBondTradingDetail$inboundSchema` instead. */ export const inboundSchema = ForeignBondTradingDetail$inboundSchema; /** @deprecated use `ForeignBondTradingDetail$outboundSchema` instead. */ export const outboundSchema = ForeignBondTradingDetail$outboundSchema; /** @deprecated use `ForeignBondTradingDetail$Outbound` instead. */ export type Outbound = ForeignBondTradingDetail$Outbound; } export function foreignBondTradingDetailToJSON( foreignBondTradingDetail: ForeignBondTradingDetail, ): string { return JSON.stringify( ForeignBondTradingDetail$outboundSchema.parse(foreignBondTradingDetail), ); } export function foreignBondTradingDetailFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ForeignBondTradingDetail$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ForeignBondTradingDetail' from JSON`, ); }