/* * 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 * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Address, Address$inboundSchema } from "./address.js"; import { Currency, Currency$inboundSchema } from "./currency.js"; import { Email, Email$inboundSchema } from "./email.js"; import { PhoneNumber, PhoneNumber$inboundSchema } from "./phonenumber.js"; import { TaxRate, TaxRate$inboundSchema } from "./taxrate.js"; /** * Based on the status some functionality is enabled or disabled. */ export const CompanyStatus = { Active: "active", Inactive: "inactive", } as const; /** * Based on the status some functionality is enabled or disabled. */ export type CompanyStatus = OpenEnum; /** * The start month of fiscal year. */ export const TheStartMonthOfFiscalYear = { January: "January", February: "February", March: "March", April: "April", May: "May", June: "June", July: "July", August: "August", September: "September", October: "October", November: "November", December: "December", } as const; /** * The start month of fiscal year. */ export type TheStartMonthOfFiscalYear = OpenEnum< typeof TheStartMonthOfFiscalYear >; /** * The mode of tracking categories for the company on transactions */ export const TrackingCategoriesMode = { Transaction: "transaction", Line: "line", Both: "both", Disabled: "disabled", } as const; /** * The mode of tracking categories for the company on transactions */ export type TrackingCategoriesMode = OpenEnum; /** * The accounting basis used by the company for financial reports. */ export const AccountingMethod = { Cash: "cash", Accrual: "accrual", } as const; /** * The accounting basis used by the company for financial reports. */ export type AccountingMethod = OpenEnum; export type CompanyInfo = { /** * A unique identifier for an object. */ id?: string | undefined; /** * The name of the company. */ companyName?: string | null | undefined; /** * Based on the status some functionality is enabled or disabled. */ status?: CompanyStatus | undefined; /** * The legal name of the company */ legalName?: string | undefined; /** * country code according to ISO 3166-1 alpha-2. */ country?: string | null | undefined; salesTaxNumber?: string | null | undefined; /** * Whether sales tax is calculated automatically for the company */ automatedSalesTax?: boolean | undefined; /** * Whether sales tax is enabled for the company */ salesTaxEnabled?: boolean | undefined; defaultSalesTax?: TaxRate | 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; /** * language code according to ISO 639-1. For the United States - EN */ language?: string | null | undefined; /** * The start month of fiscal year. */ fiscalYearStartMonth?: TheStartMonthOfFiscalYear | undefined; /** * Date when company file was created */ companyStartDate?: Date | undefined; addresses?: Array
| undefined; phoneNumbers?: Array | undefined; emails?: Array | undefined; /** * When custom mappings are configured on the resource, the result is included here. */ customMappings?: { [k: string]: any } | null | undefined; /** * Whether tracking categories are enabled for the company on transactions */ trackingCategoriesEnabled?: boolean | undefined; /** * The mode of tracking categories for the company on transactions */ trackingCategoriesMode?: TrackingCategoriesMode | undefined; /** * The accounting basis used by the company for financial reports. */ accountingMethod?: AccountingMethod | 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 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; }; /** @internal */ export const CompanyStatus$inboundSchema: z.ZodType< CompanyStatus, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(CompanyStatus)); /** @internal */ export const TheStartMonthOfFiscalYear$inboundSchema: z.ZodType< TheStartMonthOfFiscalYear, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(TheStartMonthOfFiscalYear) ); /** @internal */ export const TrackingCategoriesMode$inboundSchema: z.ZodType< TrackingCategoriesMode, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(TrackingCategoriesMode) ); /** @internal */ export const AccountingMethod$inboundSchema: z.ZodType< AccountingMethod, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(AccountingMethod) ); /** @internal */ export const CompanyInfo$inboundSchema: z.ZodType< CompanyInfo, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), company_name: z.nullable(types.string()).optional(), status: types.optional(CompanyStatus$inboundSchema), legal_name: types.optional(types.string()), country: z.nullable(types.string()).optional(), sales_tax_number: z.nullable(types.string()).optional(), automated_sales_tax: types.optional(types.boolean()), sales_tax_enabled: types.optional(types.boolean()), default_sales_tax: types.optional(TaxRate$inboundSchema), currency: z.nullable(Currency$inboundSchema).optional(), language: z.nullable(types.string()).optional(), fiscal_year_start_month: types.optional( TheStartMonthOfFiscalYear$inboundSchema, ), company_start_date: types.optional(types.date()), addresses: types.optional(z.array(Address$inboundSchema)), phone_numbers: types.optional(z.array(PhoneNumber$inboundSchema)), emails: types.optional(z.array(Email$inboundSchema)), custom_mappings: z.nullable(z.record(z.any())).optional(), tracking_categories_enabled: types.optional(types.boolean()), tracking_categories_mode: types.optional( TrackingCategoriesMode$inboundSchema, ), accounting_method: z.nullable(AccountingMethod$inboundSchema).optional(), row_version: z.nullable(types.string()).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(), }).transform((v) => { return remap$(v, { "company_name": "companyName", "legal_name": "legalName", "sales_tax_number": "salesTaxNumber", "automated_sales_tax": "automatedSalesTax", "sales_tax_enabled": "salesTaxEnabled", "default_sales_tax": "defaultSalesTax", "fiscal_year_start_month": "fiscalYearStartMonth", "company_start_date": "companyStartDate", "phone_numbers": "phoneNumbers", "custom_mappings": "customMappings", "tracking_categories_enabled": "trackingCategoriesEnabled", "tracking_categories_mode": "trackingCategoriesMode", "accounting_method": "accountingMethod", "row_version": "rowVersion", "updated_by": "updatedBy", "created_by": "createdBy", "updated_at": "updatedAt", "created_at": "createdAt", }); }) ); export function companyInfoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CompanyInfo$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CompanyInfo' from JSON`, ); }