/* * 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"; import { Currency, Currency$inboundSchema } from "./currency.js"; /** * A balance sheet assets account represents the financial position of a company at a specific point in time. */ export type BalanceSheetAssetsAccount = { /** * The unique identifier for the account. */ accountId?: string | undefined; /** * The account code of the account */ code?: string | undefined; /** * The name of the account. */ name?: string | undefined; /** * The amount or value of the item */ value?: number | undefined; /** * A list of balance sheet accounts */ items?: any | undefined; }; /** * A balance sheet liabilities account represents the financial position of a company at a specific point in time. */ export type BalanceSheetLiabilitiesAccount = { /** * The unique identifier for the account. */ accountId?: string | undefined; /** * The account code of the account */ code?: string | undefined; /** * The name of the account. */ name?: string | undefined; /** * The amount or value of the item */ value?: number | undefined; /** * A list of balance sheet accounts */ items?: any | undefined; }; /** * A balance sheet equity account represents the financial position of a company at a specific point in time. */ export type BalanceSheetEquityAccount = { /** * The unique identifier for the account. */ accountId?: string | undefined; /** * The account code of the account */ code?: string | undefined; /** * The name of the account. */ name?: string | undefined; /** * The amount or value of the item */ value?: number | undefined; /** * A list of balance sheet accounts */ items?: any | undefined; }; /** * A balance sheet uncategorized items account represents the financial position of a company at a specific point in time. */ export type BalanceSheetUncategorizedItemsAccount = { /** * The unique identifier for the account. */ accountId?: string | undefined; /** * The account code of the account */ code?: string | undefined; /** * The name of the account. */ name?: string | undefined; /** * The amount or value of the item */ value?: number | undefined; /** * A list of balance sheet accounts */ items?: any | undefined; }; export type Reports = { /** * A unique identifier for an object. */ id?: string | undefined; /** * The name of the report */ reportName?: string | undefined; /** * The start date of the report */ startDate?: string | undefined; /** * The start date of the report */ endDate: string; /** * 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; /** * A balance sheet assets account represents the financial position of a company at a specific point in time. */ assets: BalanceSheetAssetsAccount; /** * A balance sheet liabilities account represents the financial position of a company at a specific point in time. */ liabilities: BalanceSheetLiabilitiesAccount; /** * A balance sheet equity account represents the financial position of a company at a specific point in time. */ equity: BalanceSheetEquityAccount; /** * The net assets of the balance sheet */ netAssets?: number | undefined; /** * When custom mappings are configured on the resource, the result is included here. */ customMappings?: { [k: string]: any } | null | undefined; /** * The user who last updated the object. */ updatedBy?: string | null | undefined; /** * The user who created the object. */ createdBy?: string | null | undefined; /** * The date and time when the object was last updated. */ updatedAt?: Date | null | undefined; /** * The date and time when the object was created. */ createdAt?: Date | null | undefined; /** * A balance sheet uncategorized items account represents the financial position of a company at a specific point in time. */ uncategorizedItems?: BalanceSheetUncategorizedItemsAccount | undefined; }; export type BalanceSheet = { reports: Array; }; /** @internal */ export const BalanceSheetAssetsAccount$inboundSchema: z.ZodType< BalanceSheetAssetsAccount, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ account_id: types.optional(types.string()), code: types.optional(types.string()), name: types.optional(types.string()), value: types.optional(types.number()), items: types.optional(z.any()), }).transform((v) => { return remap$(v, { "account_id": "accountId", }); }) ); export function balanceSheetAssetsAccountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BalanceSheetAssetsAccount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BalanceSheetAssetsAccount' from JSON`, ); } /** @internal */ export const BalanceSheetLiabilitiesAccount$inboundSchema: z.ZodType< BalanceSheetLiabilitiesAccount, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ account_id: types.optional(types.string()), code: types.optional(types.string()), name: types.optional(types.string()), value: types.optional(types.number()), items: types.optional(z.any()), }).transform((v) => { return remap$(v, { "account_id": "accountId", }); }) ); export function balanceSheetLiabilitiesAccountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BalanceSheetLiabilitiesAccount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BalanceSheetLiabilitiesAccount' from JSON`, ); } /** @internal */ export const BalanceSheetEquityAccount$inboundSchema: z.ZodType< BalanceSheetEquityAccount, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ account_id: types.optional(types.string()), code: types.optional(types.string()), name: types.optional(types.string()), value: types.optional(types.number()), items: types.optional(z.any()), }).transform((v) => { return remap$(v, { "account_id": "accountId", }); }) ); export function balanceSheetEquityAccountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BalanceSheetEquityAccount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BalanceSheetEquityAccount' from JSON`, ); } /** @internal */ export const BalanceSheetUncategorizedItemsAccount$inboundSchema: z.ZodType< BalanceSheetUncategorizedItemsAccount, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ account_id: types.optional(types.string()), code: types.optional(types.string()), name: types.optional(types.string()), value: types.optional(types.number()), items: types.optional(z.any()), }).transform((v) => { return remap$(v, { "account_id": "accountId", }); }) ); export function balanceSheetUncategorizedItemsAccountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BalanceSheetUncategorizedItemsAccount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BalanceSheetUncategorizedItemsAccount' from JSON`, ); } /** @internal */ export const Reports$inboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), report_name: types.optional(types.string()), start_date: types.optional(types.string()), end_date: types.string(), currency: z.nullable(Currency$inboundSchema).optional(), assets: z.lazy(() => BalanceSheetAssetsAccount$inboundSchema), liabilities: z.lazy(() => BalanceSheetLiabilitiesAccount$inboundSchema), equity: z.lazy(() => BalanceSheetEquityAccount$inboundSchema), net_assets: types.optional(types.number()), custom_mappings: z.nullable(z.record(z.any())).optional(), updated_by: z.nullable(types.string()).optional(), created_by: z.nullable(types.string()).optional(), updated_at: z.nullable(types.date()).optional(), created_at: z.nullable(types.date()).optional(), uncategorized_items: types.optional( z.lazy(() => BalanceSheetUncategorizedItemsAccount$inboundSchema), ), }).transform((v) => { return remap$(v, { "report_name": "reportName", "start_date": "startDate", "end_date": "endDate", "net_assets": "netAssets", "custom_mappings": "customMappings", "updated_by": "updatedBy", "created_by": "createdBy", "updated_at": "updatedAt", "created_at": "createdAt", "uncategorized_items": "uncategorizedItems", }); }) ); export function reportsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Reports$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Reports' from JSON`, ); } /** @internal */ export const BalanceSheet$inboundSchema: z.ZodType< BalanceSheet, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ reports: z.array(z.lazy(() => Reports$inboundSchema)), }) ); export function balanceSheetFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BalanceSheet$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BalanceSheet' from JSON`, ); }