/* * 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 NSCC asset category */ export enum AssetCategory { AssetCategoryUnspecified = "ASSET_CATEGORY_UNSPECIFIED", AlternativeInvestment = "ALTERNATIVE_INVESTMENT", Annuity = "ANNUITY", AuctionRatePreferredUit = "AUCTION_RATE_PREFERRED_UIT", CdAndCommercialPaper = "CD_AND_COMMERCIAL_PAPER", CorporateBond = "CORPORATE_BOND", DeferredSaleChargeUit = "DEFERRED_SALE_CHARGE_UIT", Equity = "EQUITY", ForeignCurrency = "FOREIGN_CURRENCY", ForeignDebt = "FOREIGN_DEBT", ForeignEquity = "FOREIGN_EQUITY", LifeInsurance = "LIFE_INSURANCE", LimitedPartnership = "LIMITED_PARTNERSHIP", MortgageBackedSecurity = "MORTGAGE_BACKED_SECURITY", MutualFundMoneyMarket = "MUTUAL_FUND_MONEY_MARKET", MutualFundNonMoneyMarket = "MUTUAL_FUND_NON_MONEY_MARKET", MunicipalBond = "MUNICIPAL_BOND", Option = "OPTION", RealEstateInvestmentTrust = "REAL_ESTATE_INVESTMENT_TRUST", Right = "RIGHT", UsGovernment = "US_GOVERNMENT", UnitInvestmentTrust = "UNIT_INVESTMENT_TRUST", Unit = "UNIT", Warrant = "WARRANT", ZeroCouponBond = "ZERO_COUPON_BOND", } /** * The NSCC asset category */ export type AssetCategoryOpen = OpenEnum; /** * The quantity of the asset, or the amount if the asset is cash; negative quantity denotes short position or a DEBIT cash balance. Fractional amounts only supported for certain asset types */ export type AcatsAssetQuantity = { /** * 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; }; /** * The position or amount of the asset */ export type AcatsAssetPosition = { /** * The quantity of the asset, or the amount if the asset is cash; negative quantity denotes short position or a DEBIT cash balance. Fractional amounts only supported for certain asset types */ quantity?: AcatsAssetQuantity | null | undefined; }; /** * The asset identifier type */ export enum AcatsAssetType { IdentifierTypeUnspecified = "IDENTIFIER_TYPE_UNSPECIFIED", CurrencyCode = "CURRENCY_CODE", Cusip = "CUSIP", Symbol = "SYMBOL", Isin = "ISIN", AssetId = "ASSET_ID", } /** * The asset identifier type */ export type AcatsAssetTypeOpen = OpenEnum; /** * The asset being transferred If cash, the asset_id is the currency code (e.g. USD) and the position is the amount */ export type AcatsAsset = { /** * The NSCC asset category */ assetCategory?: AssetCategoryOpen | undefined; /** * The asset identifier */ assetId?: string | undefined; /** * The asset identifier */ identifier?: string | undefined; /** * The position or amount of the asset */ position?: AcatsAssetPosition | null | undefined; /** * The asset identifier type */ type?: AcatsAssetTypeOpen | undefined; }; /** @internal */ export const AssetCategory$inboundSchema: z.ZodType< AssetCategoryOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(AssetCategory), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const AssetCategory$outboundSchema: z.ZodType< AssetCategoryOpen, z.ZodTypeDef, AssetCategoryOpen > = z.union([ z.nativeEnum(AssetCategory), 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 AssetCategory$ { /** @deprecated use `AssetCategory$inboundSchema` instead. */ export const inboundSchema = AssetCategory$inboundSchema; /** @deprecated use `AssetCategory$outboundSchema` instead. */ export const outboundSchema = AssetCategory$outboundSchema; } /** @internal */ export const AcatsAssetQuantity$inboundSchema: z.ZodType< AcatsAssetQuantity, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type AcatsAssetQuantity$Outbound = { value?: string | undefined; }; /** @internal */ export const AcatsAssetQuantity$outboundSchema: z.ZodType< AcatsAssetQuantity$Outbound, z.ZodTypeDef, AcatsAssetQuantity > = 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 AcatsAssetQuantity$ { /** @deprecated use `AcatsAssetQuantity$inboundSchema` instead. */ export const inboundSchema = AcatsAssetQuantity$inboundSchema; /** @deprecated use `AcatsAssetQuantity$outboundSchema` instead. */ export const outboundSchema = AcatsAssetQuantity$outboundSchema; /** @deprecated use `AcatsAssetQuantity$Outbound` instead. */ export type Outbound = AcatsAssetQuantity$Outbound; } export function acatsAssetQuantityToJSON( acatsAssetQuantity: AcatsAssetQuantity, ): string { return JSON.stringify( AcatsAssetQuantity$outboundSchema.parse(acatsAssetQuantity), ); } export function acatsAssetQuantityFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AcatsAssetQuantity$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AcatsAssetQuantity' from JSON`, ); } /** @internal */ export const AcatsAssetPosition$inboundSchema: z.ZodType< AcatsAssetPosition, z.ZodTypeDef, unknown > = z.object({ quantity: z.nullable(z.lazy(() => AcatsAssetQuantity$inboundSchema)) .optional(), }); /** @internal */ export type AcatsAssetPosition$Outbound = { quantity?: AcatsAssetQuantity$Outbound | null | undefined; }; /** @internal */ export const AcatsAssetPosition$outboundSchema: z.ZodType< AcatsAssetPosition$Outbound, z.ZodTypeDef, AcatsAssetPosition > = z.object({ quantity: z.nullable(z.lazy(() => AcatsAssetQuantity$outboundSchema)) .optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AcatsAssetPosition$ { /** @deprecated use `AcatsAssetPosition$inboundSchema` instead. */ export const inboundSchema = AcatsAssetPosition$inboundSchema; /** @deprecated use `AcatsAssetPosition$outboundSchema` instead. */ export const outboundSchema = AcatsAssetPosition$outboundSchema; /** @deprecated use `AcatsAssetPosition$Outbound` instead. */ export type Outbound = AcatsAssetPosition$Outbound; } export function acatsAssetPositionToJSON( acatsAssetPosition: AcatsAssetPosition, ): string { return JSON.stringify( AcatsAssetPosition$outboundSchema.parse(acatsAssetPosition), ); } export function acatsAssetPositionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AcatsAssetPosition$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AcatsAssetPosition' from JSON`, ); } /** @internal */ export const AcatsAssetType$inboundSchema: z.ZodType< AcatsAssetTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(AcatsAssetType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const AcatsAssetType$outboundSchema: z.ZodType< AcatsAssetTypeOpen, z.ZodTypeDef, AcatsAssetTypeOpen > = z.union([ z.nativeEnum(AcatsAssetType), 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 AcatsAssetType$ { /** @deprecated use `AcatsAssetType$inboundSchema` instead. */ export const inboundSchema = AcatsAssetType$inboundSchema; /** @deprecated use `AcatsAssetType$outboundSchema` instead. */ export const outboundSchema = AcatsAssetType$outboundSchema; } /** @internal */ export const AcatsAsset$inboundSchema: z.ZodType< AcatsAsset, z.ZodTypeDef, unknown > = z.object({ asset_category: AssetCategory$inboundSchema.optional(), asset_id: z.string().optional(), identifier: z.string().optional(), position: z.nullable(z.lazy(() => AcatsAssetPosition$inboundSchema)) .optional(), type: AcatsAssetType$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "asset_category": "assetCategory", "asset_id": "assetId", }); }); /** @internal */ export type AcatsAsset$Outbound = { asset_category?: string | undefined; asset_id?: string | undefined; identifier?: string | undefined; position?: AcatsAssetPosition$Outbound | null | undefined; type?: string | undefined; }; /** @internal */ export const AcatsAsset$outboundSchema: z.ZodType< AcatsAsset$Outbound, z.ZodTypeDef, AcatsAsset > = z.object({ assetCategory: AssetCategory$outboundSchema.optional(), assetId: z.string().optional(), identifier: z.string().optional(), position: z.nullable(z.lazy(() => AcatsAssetPosition$outboundSchema)) .optional(), type: AcatsAssetType$outboundSchema.optional(), }).transform((v) => { return remap$(v, { assetCategory: "asset_category", assetId: "asset_id", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AcatsAsset$ { /** @deprecated use `AcatsAsset$inboundSchema` instead. */ export const inboundSchema = AcatsAsset$inboundSchema; /** @deprecated use `AcatsAsset$outboundSchema` instead. */ export const outboundSchema = AcatsAsset$outboundSchema; /** @deprecated use `AcatsAsset$Outbound` instead. */ export type Outbound = AcatsAsset$Outbound; } export function acatsAssetToJSON(acatsAsset: AcatsAsset): string { return JSON.stringify(AcatsAsset$outboundSchema.parse(acatsAsset)); } export function acatsAssetFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AcatsAsset$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AcatsAsset' from JSON`, ); }