/* * 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$ } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { LinkedLedgerAccount, LinkedLedgerAccount$Outbound, LinkedLedgerAccount$outboundSchema, } from "./linkedledgeraccount.js"; import { LinkedTaxRateInput, LinkedTaxRateInput$Outbound, LinkedTaxRateInput$outboundSchema, } from "./linkedtaxrateinput.js"; import { PassThroughBody, PassThroughBody$Outbound, PassThroughBody$outboundSchema, } from "./passthroughbody.js"; /** * The status of the expense category. */ export const ExpenseCategoryUpdateInputStatus = { Active: "active", Inactive: "inactive", } as const; /** * The status of the expense category. */ export type ExpenseCategoryUpdateInputStatus = OpenEnum< typeof ExpenseCategoryUpdateInputStatus >; /** * The writable shape of ExpenseCategory for a single-record update. Identical to the model with the read-only properties removed and no required properties, because PATCH is partial and the API already validates it that way. */ export type ExpenseCategoryUpdateInput = { /** * Id to be displayed. */ displayId?: string | null | undefined; /** * The name of the expense category. */ name?: string | undefined; /** * The code or external identifier of the expense category. */ code?: string | null | undefined; /** * The description of the expense category. */ description?: string | null | undefined; /** * The status of the expense category. */ status?: ExpenseCategoryUpdateInputStatus | null | undefined; account?: LinkedLedgerAccount | null | undefined; offsetAccount?: LinkedLedgerAccount | null | undefined; taxRate?: LinkedTaxRateInput | undefined; /** * Whether the expense category requires rate/quantity entry (e.g. mileage at $/mile). */ rateRequired?: boolean | null | undefined; /** * Default rate when rate_required is true (e.g. 0.67 for mileage). */ defaultRate?: number | null | undefined; /** * A binary value used to detect updates to a object and prevent data conflicts. It is incremented each time an update is made to the object. */ rowVersion?: string | null | undefined; /** * The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources. */ passThrough?: Array | undefined; }; /** @internal */ export const ExpenseCategoryUpdateInputStatus$outboundSchema: z.ZodType< string, z.ZodTypeDef, ExpenseCategoryUpdateInputStatus > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(ExpenseCategoryUpdateInputStatus) ); /** @internal */ export type ExpenseCategoryUpdateInput$Outbound = { display_id?: string | null | undefined; name?: string | undefined; code?: string | null | undefined; description?: string | null | undefined; status?: string | null | undefined; account?: LinkedLedgerAccount$Outbound | null | undefined; offset_account?: LinkedLedgerAccount$Outbound | null | undefined; tax_rate?: LinkedTaxRateInput$Outbound | undefined; rate_required?: boolean | null | undefined; default_rate?: number | null | undefined; row_version?: string | null | undefined; pass_through?: Array | undefined; }; /** @internal */ export const ExpenseCategoryUpdateInput$outboundSchema: z.ZodType< ExpenseCategoryUpdateInput$Outbound, z.ZodTypeDef, ExpenseCategoryUpdateInput > = /* @__PURE__ */ lazySchema$(() => z.object({ displayId: z.nullable(z.string()).optional(), name: z.string().optional(), code: z.nullable(z.string()).optional(), description: z.nullable(z.string()).optional(), status: z.nullable(ExpenseCategoryUpdateInputStatus$outboundSchema) .optional(), account: z.nullable(LinkedLedgerAccount$outboundSchema).optional(), offsetAccount: z.nullable(LinkedLedgerAccount$outboundSchema).optional(), taxRate: LinkedTaxRateInput$outboundSchema.optional(), rateRequired: z.nullable(z.boolean()).optional(), defaultRate: z.nullable(z.number()).optional(), rowVersion: z.nullable(z.string()).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { displayId: "display_id", offsetAccount: "offset_account", taxRate: "tax_rate", rateRequired: "rate_required", defaultRate: "default_rate", rowVersion: "row_version", passThrough: "pass_through", }); }) ); export function expenseCategoryUpdateInputToJSON( expenseCategoryUpdateInput: ExpenseCategoryUpdateInput, ): string { return JSON.stringify( ExpenseCategoryUpdateInput$outboundSchema.parse(expenseCategoryUpdateInput), ); }