/* * 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"; /** * A method of determining the cost basis of an asset that has been sold or disposed of, by identifying which specific lot of the asset was sold and using the cost of that lot to calculate the cost basis; this method is commonly used for tax purposes to determine the amount of reportable capital gains or losses By default, this is set to `COST_BASIS_LOT_DISPOSAL_MIN_TAX_TERM` */ export enum CostBasisLotDisposalMethod { CostBasisLotDisposalMethodUnspecified = "COST_BASIS_LOT_DISPOSAL_METHOD_UNSPECIFIED", CostBasisLotDisposalFifo = "COST_BASIS_LOT_DISPOSAL_FIFO", CostBasisLotDisposalLifo = "COST_BASIS_LOT_DISPOSAL_LIFO", CostBasisLotDisposalHighCost = "COST_BASIS_LOT_DISPOSAL_HIGH_COST", CostBasisLotDisposalHighCostLongTerm = "COST_BASIS_LOT_DISPOSAL_HIGH_COST_LONG_TERM", CostBasisLotDisposalHighCostShortTerm = "COST_BASIS_LOT_DISPOSAL_HIGH_COST_SHORT_TERM", CostBasisLotDisposalLowCost = "COST_BASIS_LOT_DISPOSAL_LOW_COST", CostBasisLotDisposalLowCostLongTerm = "COST_BASIS_LOT_DISPOSAL_LOW_COST_LONG_TERM", CostBasisLotDisposalLowCostShortTerm = "COST_BASIS_LOT_DISPOSAL_LOW_COST_SHORT_TERM", CostBasisLotDisposalMinTaxTerm = "COST_BASIS_LOT_DISPOSAL_MIN_TAX_TERM", } /** * A method of determining the cost basis of an asset that has been sold or disposed of, by identifying which specific lot of the asset was sold and using the cost of that lot to calculate the cost basis; this method is commonly used for tax purposes to determine the amount of reportable capital gains or losses By default, this is set to `COST_BASIS_LOT_DISPOSAL_MIN_TAX_TERM` */ export type CostBasisLotDisposalMethodOpen = OpenEnum< typeof CostBasisLotDisposalMethod >; /** * The account tax profile. */ export type AccountTaxProfileCreate = { /** * A method of determining the cost basis of an asset that has been sold or disposed of, by identifying which specific lot of the asset was sold and using the cost of that lot to calculate the cost basis; this method is commonly used for tax purposes to determine the amount of reportable capital gains or losses By default, this is set to `COST_BASIS_LOT_DISPOSAL_MIN_TAX_TERM` */ costBasisLotDisposalMethod?: CostBasisLotDisposalMethodOpen | undefined; /** * Indicates if the account is eligible to mark-to-market their securities and commodities holdings; Named after the related section of the IRS tax code. By default, this is set to `false`. */ section475Election?: boolean | undefined; }; /** @internal */ export const CostBasisLotDisposalMethod$inboundSchema: z.ZodType< CostBasisLotDisposalMethodOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(CostBasisLotDisposalMethod), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const CostBasisLotDisposalMethod$outboundSchema: z.ZodType< CostBasisLotDisposalMethodOpen, z.ZodTypeDef, CostBasisLotDisposalMethodOpen > = z.union([ z.nativeEnum(CostBasisLotDisposalMethod), 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 CostBasisLotDisposalMethod$ { /** @deprecated use `CostBasisLotDisposalMethod$inboundSchema` instead. */ export const inboundSchema = CostBasisLotDisposalMethod$inboundSchema; /** @deprecated use `CostBasisLotDisposalMethod$outboundSchema` instead. */ export const outboundSchema = CostBasisLotDisposalMethod$outboundSchema; } /** @internal */ export const AccountTaxProfileCreate$inboundSchema: z.ZodType< AccountTaxProfileCreate, z.ZodTypeDef, unknown > = z.object({ cost_basis_lot_disposal_method: CostBasisLotDisposalMethod$inboundSchema .optional(), section_475_election: z.boolean().optional(), }).transform((v) => { return remap$(v, { "cost_basis_lot_disposal_method": "costBasisLotDisposalMethod", "section_475_election": "section475Election", }); }); /** @internal */ export type AccountTaxProfileCreate$Outbound = { cost_basis_lot_disposal_method?: string | undefined; section_475_election?: boolean | undefined; }; /** @internal */ export const AccountTaxProfileCreate$outboundSchema: z.ZodType< AccountTaxProfileCreate$Outbound, z.ZodTypeDef, AccountTaxProfileCreate > = z.object({ costBasisLotDisposalMethod: CostBasisLotDisposalMethod$outboundSchema .optional(), section475Election: z.boolean().optional(), }).transform((v) => { return remap$(v, { costBasisLotDisposalMethod: "cost_basis_lot_disposal_method", section475Election: "section_475_election", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountTaxProfileCreate$ { /** @deprecated use `AccountTaxProfileCreate$inboundSchema` instead. */ export const inboundSchema = AccountTaxProfileCreate$inboundSchema; /** @deprecated use `AccountTaxProfileCreate$outboundSchema` instead. */ export const outboundSchema = AccountTaxProfileCreate$outboundSchema; /** @deprecated use `AccountTaxProfileCreate$Outbound` instead. */ export type Outbound = AccountTaxProfileCreate$Outbound; } export function accountTaxProfileCreateToJSON( accountTaxProfileCreate: AccountTaxProfileCreate, ): string { return JSON.stringify( AccountTaxProfileCreate$outboundSchema.parse(accountTaxProfileCreate), ); } export function accountTaxProfileCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountTaxProfileCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountTaxProfileCreate' from JSON`, ); }