/* * 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 price adjustment being applied by the broker to the net price of the security. */ export enum PriceAdjustmentType { PriceAdjustmentTypeUnspecified = "PRICE_ADJUSTMENT_TYPE_UNSPECIFIED", Markup = "MARKUP", Markdown = "MARKDOWN", GrossCredit = "GROSS_CREDIT", } /** * The type of price adjustment being applied by the broker to the net price of the security. */ export type PriceAdjustmentTypeOpen = OpenEnum; /** * Price adjustment that will be applied to the net price of the security. */ export type PriceAdjustmentCreate = { /** * 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 */ priceAdjustmentAmount: DecimalCreate; /** * The type of price adjustment being applied by the broker to the net price of the security. */ priceAdjustmentType: PriceAdjustmentTypeOpen; }; /** @internal */ export const PriceAdjustmentType$inboundSchema: z.ZodType< PriceAdjustmentTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(PriceAdjustmentType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const PriceAdjustmentType$outboundSchema: z.ZodType< PriceAdjustmentTypeOpen, z.ZodTypeDef, PriceAdjustmentTypeOpen > = z.union([ z.nativeEnum(PriceAdjustmentType), 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 PriceAdjustmentType$ { /** @deprecated use `PriceAdjustmentType$inboundSchema` instead. */ export const inboundSchema = PriceAdjustmentType$inboundSchema; /** @deprecated use `PriceAdjustmentType$outboundSchema` instead. */ export const outboundSchema = PriceAdjustmentType$outboundSchema; } /** @internal */ export const PriceAdjustmentCreate$inboundSchema: z.ZodType< PriceAdjustmentCreate, z.ZodTypeDef, unknown > = z.object({ price_adjustment_amount: DecimalCreate$inboundSchema, price_adjustment_type: PriceAdjustmentType$inboundSchema, }).transform((v) => { return remap$(v, { "price_adjustment_amount": "priceAdjustmentAmount", "price_adjustment_type": "priceAdjustmentType", }); }); /** @internal */ export type PriceAdjustmentCreate$Outbound = { price_adjustment_amount: DecimalCreate$Outbound; price_adjustment_type: string; }; /** @internal */ export const PriceAdjustmentCreate$outboundSchema: z.ZodType< PriceAdjustmentCreate$Outbound, z.ZodTypeDef, PriceAdjustmentCreate > = z.object({ priceAdjustmentAmount: DecimalCreate$outboundSchema, priceAdjustmentType: PriceAdjustmentType$outboundSchema, }).transform((v) => { return remap$(v, { priceAdjustmentAmount: "price_adjustment_amount", priceAdjustmentType: "price_adjustment_type", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PriceAdjustmentCreate$ { /** @deprecated use `PriceAdjustmentCreate$inboundSchema` instead. */ export const inboundSchema = PriceAdjustmentCreate$inboundSchema; /** @deprecated use `PriceAdjustmentCreate$outboundSchema` instead. */ export const outboundSchema = PriceAdjustmentCreate$outboundSchema; /** @deprecated use `PriceAdjustmentCreate$Outbound` instead. */ export type Outbound = PriceAdjustmentCreate$Outbound; } export function priceAdjustmentCreateToJSON( priceAdjustmentCreate: PriceAdjustmentCreate, ): string { return JSON.stringify( PriceAdjustmentCreate$outboundSchema.parse(priceAdjustmentCreate), ); } export function priceAdjustmentCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PriceAdjustmentCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PriceAdjustmentCreate' from JSON`, ); }