/* * 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 { DecimalCreate, DecimalCreate$inboundSchema, DecimalCreate$Outbound, DecimalCreate$outboundSchema, } from "./decimalcreate.js"; /** * The type of fee */ export enum BookingFeeCreateType { FeeTypeUnspecified = "FEE_TYPE_UNSPECIFIED", ClientClearing = "CLIENT_CLEARING", Liquidity = "LIQUIDITY", TradeActivity = "TRADE_ACTIVITY", FinancialTransactionTax = "FINANCIAL_TRANSACTION_TAX", IndexOptionFee = "INDEX_OPTION_FEE", SecFee = "SEC_FEE", OptionsRegulatory = "OPTIONS_REGULATORY", GeneralPurposeFee = "GENERAL_PURPOSE_FEE", BrokerFee = "BROKER_FEE", ContractFee = "CONTRACT_FEE", OccFee = "OCC_FEE", } /** * The type of fee */ export type BookingFeeCreateTypeOpen = OpenEnum; /** * Fee message includes both fee type as well as the fee amount */ export type BookingFeeCreate = { /** * A representation of a decimal value, such as 2.5. Clients may convert values into language-native decimal formats, such as Java's [BigDecimal][] or Python's [decimal.Decimal][]. * * @remarks * * [BigDecimal]: * https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html * [decimal.Decimal]: https://docs.python.org/3/library/decimal.html */ amount?: DecimalCreate | undefined; /** * Indicates whether to explicitly suppress this fee type. If the trade would normally calculate fees (e.g., for TRADE_ACTIVITY), the client can add a fee with this boolean value set to true, and the Booking Service will not calculate or assess that fee on the trade. */ suppressFee?: boolean | undefined; /** * The type of fee */ type?: BookingFeeCreateTypeOpen | undefined; }; /** @internal */ export const BookingFeeCreateType$inboundSchema: z.ZodType< BookingFeeCreateTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(BookingFeeCreateType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const BookingFeeCreateType$outboundSchema: z.ZodType< BookingFeeCreateTypeOpen, z.ZodTypeDef, BookingFeeCreateTypeOpen > = z.union([ z.nativeEnum(BookingFeeCreateType), 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 BookingFeeCreateType$ { /** @deprecated use `BookingFeeCreateType$inboundSchema` instead. */ export const inboundSchema = BookingFeeCreateType$inboundSchema; /** @deprecated use `BookingFeeCreateType$outboundSchema` instead. */ export const outboundSchema = BookingFeeCreateType$outboundSchema; } /** @internal */ export const BookingFeeCreate$inboundSchema: z.ZodType< BookingFeeCreate, z.ZodTypeDef, unknown > = z.object({ amount: DecimalCreate$inboundSchema.optional(), suppress_fee: z.boolean().optional(), type: BookingFeeCreateType$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "suppress_fee": "suppressFee", }); }); /** @internal */ export type BookingFeeCreate$Outbound = { amount?: DecimalCreate$Outbound | undefined; suppress_fee?: boolean | undefined; type?: string | undefined; }; /** @internal */ export const BookingFeeCreate$outboundSchema: z.ZodType< BookingFeeCreate$Outbound, z.ZodTypeDef, BookingFeeCreate > = z.object({ amount: DecimalCreate$outboundSchema.optional(), suppressFee: z.boolean().optional(), type: BookingFeeCreateType$outboundSchema.optional(), }).transform((v) => { return remap$(v, { suppressFee: "suppress_fee", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace BookingFeeCreate$ { /** @deprecated use `BookingFeeCreate$inboundSchema` instead. */ export const inboundSchema = BookingFeeCreate$inboundSchema; /** @deprecated use `BookingFeeCreate$outboundSchema` instead. */ export const outboundSchema = BookingFeeCreate$outboundSchema; /** @deprecated use `BookingFeeCreate$Outbound` instead. */ export type Outbound = BookingFeeCreate$Outbound; } export function bookingFeeCreateToJSON( bookingFeeCreate: BookingFeeCreate, ): string { return JSON.stringify( BookingFeeCreate$outboundSchema.parse(bookingFeeCreate), ); } export function bookingFeeCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BookingFeeCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BookingFeeCreate' from JSON`, ); }