/* * 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 { BankAccount, BankAccount$Outbound, BankAccount$outboundSchema, } from "./bankaccount.js"; import { Currency, Currency$outboundSchema } from "./currency.js"; import { CustomField, CustomField$Outbound, CustomField$outboundSchema, } from "./customfield.js"; import { LinkedTaxRateInput, LinkedTaxRateInput$Outbound, LinkedTaxRateInput$outboundSchema, } from "./linkedtaxrateinput.js"; import { PassThroughBody, PassThroughBody$Outbound, PassThroughBody$outboundSchema, } from "./passthroughbody.js"; /** * The classification of account. */ export const LedgerAccountCreateInputClassification = { Asset: "asset", Equity: "equity", Expense: "expense", Liability: "liability", Revenue: "revenue", Income: "income", OtherIncome: "other_income", OtherExpense: "other_expense", CostsOfSales: "costs_of_sales", Other: "other", } as const; /** * The classification of account. */ export type LedgerAccountCreateInputClassification = OpenEnum< typeof LedgerAccountCreateInputClassification >; /** * The type of account. */ export const LedgerAccountCreateInputType = { AccountsPayable: "accounts_payable", AccountsReceivable: "accounts_receivable", Balancesheet: "balancesheet", Bank: "bank", CostsOfSales: "costs_of_sales", CreditCard: "credit_card", CurrentAsset: "current_asset", CurrentLiability: "current_liability", Equity: "equity", Expense: "expense", FixedAsset: "fixed_asset", NonCurrentAsset: "non_current_asset", NonCurrentLiability: "non_current_liability", OtherAsset: "other_asset", OtherExpense: "other_expense", OtherIncome: "other_income", OtherLiability: "other_liability", Revenue: "revenue", Sales: "sales", Other: "other", } as const; /** * The type of account. */ export type LedgerAccountCreateInputType = OpenEnum< typeof LedgerAccountCreateInputType >; /** * The status of the account. */ export const LedgerAccountCreateInputAccountStatus = { Active: "active", Inactive: "inactive", Archived: "archived", } as const; /** * The status of the account. */ export type LedgerAccountCreateInputAccountStatus = OpenEnum< typeof LedgerAccountCreateInputAccountStatus >; export type LedgerAccountCreateInputParentAccount = { /** * The ID of the parent account. */ id?: string | undefined; /** * The name of the parent account. */ name?: string | undefined; /** * The human readable display ID used when displaying the parent account */ displayId?: string | undefined; }; export type LedgerAccountCreateInputSubsidiaries = { /** * The ID of the subsidiary. */ id?: string | undefined; }; /** * The writable shape of LedgerAccount for a batch create. Identical to [LedgerAccount](the model returned on reads) with the read-only properties removed — the same properties the single-record create endpoint rejects, so a batched record and a single-record create accept exactly the same body. */ export type LedgerAccountCreateInput = { /** * The human readable display ID used when displaying the account */ displayId?: string | undefined; /** * The nominal code of the ledger account. * * @deprecated field: This field is deprecated and may be removed in a future version.. */ nominalCode?: string | null | undefined; /** * The code assigned to the account. */ code?: string | null | undefined; /** * The classification of account. */ classification?: LedgerAccountCreateInputClassification | null | undefined; /** * The type of account. */ type?: LedgerAccountCreateInputType | undefined; /** * The sub type of account. */ subType?: string | null | undefined; /** * The name of the account. */ name?: string | null | undefined; /** * The fully qualified name of the account. */ fullyQualifiedName?: string | null | undefined; /** * The description of the account. */ description?: string | null | undefined; /** * The opening balance of the account. */ openingBalance?: number | null | undefined; /** * The current balance of the account. */ currentBalance?: number | null | undefined; /** * Indicates the associated currency for an amount of money. Values correspond to [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217). */ currency?: Currency | null | undefined; /** * The tax type of the account. */ taxType?: string | null | undefined; taxRate?: LinkedTaxRateInput | undefined; level?: number | null | undefined; /** * Whether the account is active or not. */ active?: boolean | null | undefined; /** * The status of the account. */ status?: LedgerAccountCreateInputAccountStatus | null | undefined; /** * Whether the account is a header or not. */ header?: boolean | null | undefined; bankAccount?: BankAccount | undefined; parentAccount?: LedgerAccountCreateInputParentAccount | undefined; /** * Whether the account is a sub account or not. */ subAccount?: boolean | null | undefined; /** * Reconciliation Date means the last calendar day of each Reconciliation Period. */ lastReconciliationDate?: Date | null | undefined; /** * The subsidiaries the account belongs to. */ subsidiaries?: Array | undefined; customFields?: Array | 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 LedgerAccountCreateInputClassification$outboundSchema: z.ZodType< string, z.ZodTypeDef, LedgerAccountCreateInputClassification > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(LedgerAccountCreateInputClassification) ); /** @internal */ export const LedgerAccountCreateInputType$outboundSchema: z.ZodType< string, z.ZodTypeDef, LedgerAccountCreateInputType > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(LedgerAccountCreateInputType) ); /** @internal */ export const LedgerAccountCreateInputAccountStatus$outboundSchema: z.ZodType< string, z.ZodTypeDef, LedgerAccountCreateInputAccountStatus > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(LedgerAccountCreateInputAccountStatus) ); /** @internal */ export type LedgerAccountCreateInputParentAccount$Outbound = { id?: string | undefined; name?: string | undefined; display_id?: string | undefined; }; /** @internal */ export const LedgerAccountCreateInputParentAccount$outboundSchema: z.ZodType< LedgerAccountCreateInputParentAccount$Outbound, z.ZodTypeDef, LedgerAccountCreateInputParentAccount > = /* @__PURE__ */ lazySchema$(() => z.object({ id: z.string().optional(), name: z.string().optional(), displayId: z.string().optional(), }).transform((v) => { return remap$(v, { displayId: "display_id", }); }) ); export function ledgerAccountCreateInputParentAccountToJSON( ledgerAccountCreateInputParentAccount: LedgerAccountCreateInputParentAccount, ): string { return JSON.stringify( LedgerAccountCreateInputParentAccount$outboundSchema.parse( ledgerAccountCreateInputParentAccount, ), ); } /** @internal */ export type LedgerAccountCreateInputSubsidiaries$Outbound = { id?: string | undefined; }; /** @internal */ export const LedgerAccountCreateInputSubsidiaries$outboundSchema: z.ZodType< LedgerAccountCreateInputSubsidiaries$Outbound, z.ZodTypeDef, LedgerAccountCreateInputSubsidiaries > = /* @__PURE__ */ lazySchema$(() => z.object({ id: z.string().optional(), }) ); export function ledgerAccountCreateInputSubsidiariesToJSON( ledgerAccountCreateInputSubsidiaries: LedgerAccountCreateInputSubsidiaries, ): string { return JSON.stringify( LedgerAccountCreateInputSubsidiaries$outboundSchema.parse( ledgerAccountCreateInputSubsidiaries, ), ); } /** @internal */ export type LedgerAccountCreateInput$Outbound = { display_id?: string | undefined; nominal_code?: string | null | undefined; code?: string | null | undefined; classification?: string | null | undefined; type?: string | undefined; sub_type?: string | null | undefined; name?: string | null | undefined; fully_qualified_name?: string | null | undefined; description?: string | null | undefined; opening_balance?: number | null | undefined; current_balance?: number | null | undefined; currency?: string | null | undefined; tax_type?: string | null | undefined; tax_rate?: LinkedTaxRateInput$Outbound | undefined; level?: number | null | undefined; active?: boolean | null | undefined; status?: string | null | undefined; header?: boolean | null | undefined; bank_account?: BankAccount$Outbound | undefined; parent_account?: LedgerAccountCreateInputParentAccount$Outbound | undefined; sub_account?: boolean | null | undefined; last_reconciliation_date?: string | null | undefined; subsidiaries?: | Array | undefined; custom_fields?: Array | undefined; row_version?: string | null | undefined; pass_through?: Array | undefined; }; /** @internal */ export const LedgerAccountCreateInput$outboundSchema: z.ZodType< LedgerAccountCreateInput$Outbound, z.ZodTypeDef, LedgerAccountCreateInput > = /* @__PURE__ */ lazySchema$(() => z.object({ displayId: z.string().optional(), nominalCode: z.nullable(z.string()).optional(), code: z.nullable(z.string()).optional(), classification: z.nullable( LedgerAccountCreateInputClassification$outboundSchema, ).optional(), type: LedgerAccountCreateInputType$outboundSchema.optional(), subType: z.nullable(z.string()).optional(), name: z.nullable(z.string()).optional(), fullyQualifiedName: z.nullable(z.string()).optional(), description: z.nullable(z.string()).optional(), openingBalance: z.nullable(z.number()).optional(), currentBalance: z.nullable(z.number()).optional(), currency: z.nullable(Currency$outboundSchema).optional(), taxType: z.nullable(z.string()).optional(), taxRate: LinkedTaxRateInput$outboundSchema.optional(), level: z.nullable(z.number()).optional(), active: z.nullable(z.boolean()).optional(), status: z.nullable(LedgerAccountCreateInputAccountStatus$outboundSchema) .optional(), header: z.nullable(z.boolean()).optional(), bankAccount: BankAccount$outboundSchema.optional(), parentAccount: z.lazy(() => LedgerAccountCreateInputParentAccount$outboundSchema ).optional(), subAccount: z.nullable(z.boolean()).optional(), lastReconciliationDate: z.nullable( z.date().transform(v => v.toISOString().slice(0, "YYYY-MM-DD".length)), ).optional(), subsidiaries: z.array( z.lazy(() => LedgerAccountCreateInputSubsidiaries$outboundSchema), ).optional(), customFields: z.array(CustomField$outboundSchema).optional(), rowVersion: z.nullable(z.string()).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { displayId: "display_id", nominalCode: "nominal_code", subType: "sub_type", fullyQualifiedName: "fully_qualified_name", openingBalance: "opening_balance", currentBalance: "current_balance", taxType: "tax_type", taxRate: "tax_rate", bankAccount: "bank_account", parentAccount: "parent_account", subAccount: "sub_account", lastReconciliationDate: "last_reconciliation_date", customFields: "custom_fields", rowVersion: "row_version", passThrough: "pass_through", }); }) ); export function ledgerAccountCreateInputToJSON( ledgerAccountCreateInput: LedgerAccountCreateInput, ): string { return JSON.stringify( LedgerAccountCreateInput$outboundSchema.parse(ledgerAccountCreateInput), ); }