/* * 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 percentage used to determine the proportion of the deliverable asset(s) or cash assigned to each option contract in a settlement or corporate action scenario. */ export type AllocationPercentage = { /** * 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 cash amount of the deliverable */ export type CashAmount = { /** * 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 cash type of the deliverable */ export enum CashType { CashTypeUnspecified = "CASH_TYPE_UNSPECIFIED", CashDifferential = "CASH_DIFFERENTIAL", CashFixed = "CASH_FIXED", } /** * The cash type of the deliverable */ export type CashTypeOpen = OpenEnum; /** * The quantity of the deliverable */ export type OptionDeliverableQuantity = { /** * 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; }; /** * Specifies the timeline for settling a transaction */ export enum SettlementConvention { SettlementConventionUnspecified = "SETTLEMENT_CONVENTION_UNSPECIFIED", TPlus0 = "T_PLUS_0", TPlus1 = "T_PLUS_1", } /** * Specifies the timeline for settling a transaction */ export type SettlementConventionOpen = OpenEnum; /** * Indicates the current status of the settlement process for the deliverable asset(s) tied to an option, such as regular settlement or delayed. */ export enum SettlementStatus { SettlementStatusUnspecified = "SETTLEMENT_STATUS_UNSPECIFIED", Regular = "REGULAR", Delayed = "DELAYED", } /** * Indicates the current status of the settlement process for the deliverable asset(s) tied to an option, such as regular settlement or delayed. */ export type SettlementStatusOpen = OpenEnum; /** * OptionDeliverable */ export type OptionDeliverable = { /** * The percentage used to determine the proportion of the deliverable asset(s) or cash assigned to each option contract in a settlement or corporate action scenario. */ allocationPercentage?: AllocationPercentage | null | undefined; /** * The Ascend asset id associated with this deliverable, populated when we are able to find an asset with a matching cusip in the US */ assetId?: string | undefined; /** * The cash amount of the deliverable */ cashAmount?: CashAmount | null | undefined; /** * The cash type of the deliverable */ cashType?: CashTypeOpen | undefined; /** * The cusip of the deliverable, if provided by OCC */ cusip?: string | undefined; /** * When a deliverable is pending a NameChange or SymbolChange, the pending_cusip field may be populated with the new cusip */ pendingCusip?: string | undefined; /** * The quantity of the deliverable */ quantity?: OptionDeliverableQuantity | null | undefined; /** * Specifies the timeline for settling a transaction */ settlementConvention?: SettlementConventionOpen | undefined; /** * Indicates the current status of the settlement process for the deliverable asset(s) tied to an option, such as regular settlement or delayed. */ settlementStatus?: SettlementStatusOpen | undefined; }; /** @internal */ export const AllocationPercentage$inboundSchema: z.ZodType< AllocationPercentage, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type AllocationPercentage$Outbound = { value?: string | undefined; }; /** @internal */ export const AllocationPercentage$outboundSchema: z.ZodType< AllocationPercentage$Outbound, z.ZodTypeDef, AllocationPercentage > = 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 AllocationPercentage$ { /** @deprecated use `AllocationPercentage$inboundSchema` instead. */ export const inboundSchema = AllocationPercentage$inboundSchema; /** @deprecated use `AllocationPercentage$outboundSchema` instead. */ export const outboundSchema = AllocationPercentage$outboundSchema; /** @deprecated use `AllocationPercentage$Outbound` instead. */ export type Outbound = AllocationPercentage$Outbound; } export function allocationPercentageToJSON( allocationPercentage: AllocationPercentage, ): string { return JSON.stringify( AllocationPercentage$outboundSchema.parse(allocationPercentage), ); } export function allocationPercentageFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AllocationPercentage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AllocationPercentage' from JSON`, ); } /** @internal */ export const CashAmount$inboundSchema: z.ZodType< CashAmount, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type CashAmount$Outbound = { value?: string | undefined; }; /** @internal */ export const CashAmount$outboundSchema: z.ZodType< CashAmount$Outbound, z.ZodTypeDef, CashAmount > = 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 CashAmount$ { /** @deprecated use `CashAmount$inboundSchema` instead. */ export const inboundSchema = CashAmount$inboundSchema; /** @deprecated use `CashAmount$outboundSchema` instead. */ export const outboundSchema = CashAmount$outboundSchema; /** @deprecated use `CashAmount$Outbound` instead. */ export type Outbound = CashAmount$Outbound; } export function cashAmountToJSON(cashAmount: CashAmount): string { return JSON.stringify(CashAmount$outboundSchema.parse(cashAmount)); } export function cashAmountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CashAmount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CashAmount' from JSON`, ); } /** @internal */ export const CashType$inboundSchema: z.ZodType< CashTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(CashType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const CashType$outboundSchema: z.ZodType< CashTypeOpen, z.ZodTypeDef, CashTypeOpen > = z.union([ z.nativeEnum(CashType), 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 CashType$ { /** @deprecated use `CashType$inboundSchema` instead. */ export const inboundSchema = CashType$inboundSchema; /** @deprecated use `CashType$outboundSchema` instead. */ export const outboundSchema = CashType$outboundSchema; } /** @internal */ export const OptionDeliverableQuantity$inboundSchema: z.ZodType< OptionDeliverableQuantity, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type OptionDeliverableQuantity$Outbound = { value?: string | undefined; }; /** @internal */ export const OptionDeliverableQuantity$outboundSchema: z.ZodType< OptionDeliverableQuantity$Outbound, z.ZodTypeDef, OptionDeliverableQuantity > = 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 OptionDeliverableQuantity$ { /** @deprecated use `OptionDeliverableQuantity$inboundSchema` instead. */ export const inboundSchema = OptionDeliverableQuantity$inboundSchema; /** @deprecated use `OptionDeliverableQuantity$outboundSchema` instead. */ export const outboundSchema = OptionDeliverableQuantity$outboundSchema; /** @deprecated use `OptionDeliverableQuantity$Outbound` instead. */ export type Outbound = OptionDeliverableQuantity$Outbound; } export function optionDeliverableQuantityToJSON( optionDeliverableQuantity: OptionDeliverableQuantity, ): string { return JSON.stringify( OptionDeliverableQuantity$outboundSchema.parse(optionDeliverableQuantity), ); } export function optionDeliverableQuantityFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OptionDeliverableQuantity$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OptionDeliverableQuantity' from JSON`, ); } /** @internal */ export const SettlementConvention$inboundSchema: z.ZodType< SettlementConventionOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(SettlementConvention), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const SettlementConvention$outboundSchema: z.ZodType< SettlementConventionOpen, z.ZodTypeDef, SettlementConventionOpen > = z.union([ z.nativeEnum(SettlementConvention), 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 SettlementConvention$ { /** @deprecated use `SettlementConvention$inboundSchema` instead. */ export const inboundSchema = SettlementConvention$inboundSchema; /** @deprecated use `SettlementConvention$outboundSchema` instead. */ export const outboundSchema = SettlementConvention$outboundSchema; } /** @internal */ export const SettlementStatus$inboundSchema: z.ZodType< SettlementStatusOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(SettlementStatus), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const SettlementStatus$outboundSchema: z.ZodType< SettlementStatusOpen, z.ZodTypeDef, SettlementStatusOpen > = z.union([ z.nativeEnum(SettlementStatus), 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 SettlementStatus$ { /** @deprecated use `SettlementStatus$inboundSchema` instead. */ export const inboundSchema = SettlementStatus$inboundSchema; /** @deprecated use `SettlementStatus$outboundSchema` instead. */ export const outboundSchema = SettlementStatus$outboundSchema; } /** @internal */ export const OptionDeliverable$inboundSchema: z.ZodType< OptionDeliverable, z.ZodTypeDef, unknown > = z.object({ allocation_percentage: z.nullable( z.lazy(() => AllocationPercentage$inboundSchema), ).optional(), asset_id: z.string().optional(), cash_amount: z.nullable(z.lazy(() => CashAmount$inboundSchema)).optional(), cash_type: CashType$inboundSchema.optional(), cusip: z.string().optional(), pending_cusip: z.string().optional(), quantity: z.nullable(z.lazy(() => OptionDeliverableQuantity$inboundSchema)) .optional(), settlement_convention: SettlementConvention$inboundSchema.optional(), settlement_status: SettlementStatus$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "allocation_percentage": "allocationPercentage", "asset_id": "assetId", "cash_amount": "cashAmount", "cash_type": "cashType", "pending_cusip": "pendingCusip", "settlement_convention": "settlementConvention", "settlement_status": "settlementStatus", }); }); /** @internal */ export type OptionDeliverable$Outbound = { allocation_percentage?: AllocationPercentage$Outbound | null | undefined; asset_id?: string | undefined; cash_amount?: CashAmount$Outbound | null | undefined; cash_type?: string | undefined; cusip?: string | undefined; pending_cusip?: string | undefined; quantity?: OptionDeliverableQuantity$Outbound | null | undefined; settlement_convention?: string | undefined; settlement_status?: string | undefined; }; /** @internal */ export const OptionDeliverable$outboundSchema: z.ZodType< OptionDeliverable$Outbound, z.ZodTypeDef, OptionDeliverable > = z.object({ allocationPercentage: z.nullable( z.lazy(() => AllocationPercentage$outboundSchema), ).optional(), assetId: z.string().optional(), cashAmount: z.nullable(z.lazy(() => CashAmount$outboundSchema)).optional(), cashType: CashType$outboundSchema.optional(), cusip: z.string().optional(), pendingCusip: z.string().optional(), quantity: z.nullable(z.lazy(() => OptionDeliverableQuantity$outboundSchema)) .optional(), settlementConvention: SettlementConvention$outboundSchema.optional(), settlementStatus: SettlementStatus$outboundSchema.optional(), }).transform((v) => { return remap$(v, { allocationPercentage: "allocation_percentage", assetId: "asset_id", cashAmount: "cash_amount", cashType: "cash_type", pendingCusip: "pending_cusip", settlementConvention: "settlement_convention", settlementStatus: "settlement_status", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace OptionDeliverable$ { /** @deprecated use `OptionDeliverable$inboundSchema` instead. */ export const inboundSchema = OptionDeliverable$inboundSchema; /** @deprecated use `OptionDeliverable$outboundSchema` instead. */ export const outboundSchema = OptionDeliverable$outboundSchema; /** @deprecated use `OptionDeliverable$Outbound` instead. */ export type Outbound = OptionDeliverable$Outbound; } export function optionDeliverableToJSON( optionDeliverable: OptionDeliverable, ): string { return JSON.stringify( OptionDeliverable$outboundSchema.parse(optionDeliverable), ); } export function optionDeliverableFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OptionDeliverable$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OptionDeliverable' from JSON`, ); }