/* * 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, Address$Outbound, Address$outboundSchema, } from "./address.js"; import { PassThroughBody, PassThroughBody$inboundSchema, PassThroughBody$Outbound, PassThroughBody$outboundSchema, } from "./passthroughbody.js"; import { SubsidiaryReference, SubsidiaryReference$inboundSchema, } from "./subsidiaryreference.js"; import { SubsidiaryReferenceInput, SubsidiaryReferenceInput$Outbound, SubsidiaryReferenceInput$outboundSchema, } from "./subsidiaryreferenceinput.js"; /** * Based on the status some functionality is enabled or disabled. */ export const LocationStatus = { Active: "active", Inactive: "inactive", } as const; /** * Based on the status some functionality is enabled or disabled. */ export type LocationStatus = OpenEnum; export type AccountingLocation = { /** * A unique identifier for an object. */ id?: string | undefined; /** * A unique identifier for an object. */ parentId?: string | null | undefined; /** * Id to be displayed. */ displayId?: string | null | undefined; /** * The third-party API ID of original entity */ downstreamId?: string | null | undefined; /** * The name of the company. */ companyName?: string | null | undefined; /** * The display name of the location. */ displayName?: string | null | undefined; /** * Based on the status some functionality is enabled or disabled. */ status?: LocationStatus | undefined; addresses?: Array
| undefined; subsidiaries?: Array | undefined; /** * When custom mappings are configured on the resource, the result is included here. */ customMappings?: { [k: string]: any } | 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; /** * The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources. */ passThrough?: Array | undefined; }; export type AccountingLocationInput = { /** * A unique identifier for an object. */ parentId?: string | null | undefined; /** * Id to be displayed. */ displayId?: string | null | undefined; /** * The name of the company. */ companyName?: string | null | undefined; /** * The display name of the location. */ displayName?: string | null | undefined; /** * Based on the status some functionality is enabled or disabled. */ status?: LocationStatus | undefined; addresses?: Array
| undefined; subsidiaries?: 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 LocationStatus$inboundSchema: z.ZodType< LocationStatus, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(LocationStatus)); /** @internal */ export const LocationStatus$outboundSchema: z.ZodType< string, z.ZodTypeDef, LocationStatus > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(LocationStatus)); /** @internal */ export const AccountingLocation$inboundSchema: z.ZodType< AccountingLocation, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), parent_id: z.nullable(types.string()).optional(), display_id: z.nullable(types.string()).optional(), downstream_id: z.nullable(types.string()).optional(), company_name: z.nullable(types.string()).optional(), display_name: z.nullable(types.string()).optional(), status: types.optional(LocationStatus$inboundSchema), addresses: types.optional(z.array(Address$inboundSchema)), subsidiaries: types.optional(z.array(SubsidiaryReference$inboundSchema)), custom_mappings: z.nullable(z.record(z.any())).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(), pass_through: types.optional(z.array(PassThroughBody$inboundSchema)), }).transform((v) => { return remap$(v, { "parent_id": "parentId", "display_id": "displayId", "downstream_id": "downstreamId", "company_name": "companyName", "display_name": "displayName", "custom_mappings": "customMappings", "row_version": "rowVersion", "updated_by": "updatedBy", "created_by": "createdBy", "updated_at": "updatedAt", "created_at": "createdAt", "pass_through": "passThrough", }); }) ); export function accountingLocationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingLocation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingLocation' from JSON`, ); } /** @internal */ export type AccountingLocationInput$Outbound = { parent_id?: string | null | undefined; display_id?: string | null | undefined; company_name?: string | null | undefined; display_name?: string | null | undefined; status?: string | undefined; addresses?: Array | undefined; subsidiaries?: Array | undefined; row_version?: string | null | undefined; pass_through?: Array | undefined; }; /** @internal */ export const AccountingLocationInput$outboundSchema: z.ZodType< AccountingLocationInput$Outbound, z.ZodTypeDef, AccountingLocationInput > = /* @__PURE__ */ lazySchema$(() => z.object({ parentId: z.nullable(z.string()).optional(), displayId: z.nullable(z.string()).optional(), companyName: z.nullable(z.string()).optional(), displayName: z.nullable(z.string()).optional(), status: LocationStatus$outboundSchema.optional(), addresses: z.array(Address$outboundSchema).optional(), subsidiaries: z.array(SubsidiaryReferenceInput$outboundSchema).optional(), rowVersion: z.nullable(z.string()).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { parentId: "parent_id", displayId: "display_id", companyName: "company_name", displayName: "display_name", rowVersion: "row_version", passThrough: "pass_through", }); }) ); export function accountingLocationInputToJSON( accountingLocationInput: AccountingLocationInput, ): string { return JSON.stringify( AccountingLocationInput$outboundSchema.parse(accountingLocationInput), ); }