/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * The expense category this entity is linked to. */ export type LinkedExpenseCategory = { /** * The ID of the expense category. */ id?: string | undefined; /** * The third-party API ID of the expense category. */ downstreamId?: string | null | undefined; /** * The display ID of the expense category. */ displayId?: string | null | undefined; /** * The name of the expense category. */ name?: string | null | undefined; }; /** @internal */ export const LinkedExpenseCategory$inboundSchema: z.ZodType< LinkedExpenseCategory, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), downstream_id: z.nullable(types.string()).optional(), display_id: z.nullable(types.string()).optional(), name: z.nullable(types.string()).optional(), }).transform((v) => { return remap$(v, { "downstream_id": "downstreamId", "display_id": "displayId", }); }) ); /** @internal */ export type LinkedExpenseCategory$Outbound = { id?: string | undefined; downstream_id?: string | null | undefined; display_id?: string | null | undefined; name?: string | null | undefined; }; /** @internal */ export const LinkedExpenseCategory$outboundSchema: z.ZodType< LinkedExpenseCategory$Outbound, z.ZodTypeDef, LinkedExpenseCategory > = /* @__PURE__ */ lazySchema$(() => z.object({ id: z.string().optional(), downstreamId: z.nullable(z.string()).optional(), displayId: z.nullable(z.string()).optional(), name: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { downstreamId: "downstream_id", displayId: "display_id", }); }) ); export function linkedExpenseCategoryToJSON( linkedExpenseCategory: LinkedExpenseCategory, ): string { return JSON.stringify( LinkedExpenseCategory$outboundSchema.parse(linkedExpenseCategory), ); } export function linkedExpenseCategoryFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LinkedExpenseCategory$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LinkedExpenseCategory' from JSON`, ); }