/* * 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 { 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 DepartmentStatus = { Active: "active", Inactive: "inactive", } as const; /** * Based on the status some functionality is enabled or disabled. */ export type DepartmentStatus = OpenEnum; export type AccountingDepartment = { /** * 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 name of the department. */ name?: string | null | undefined; /** * Based on the status some functionality is enabled or disabled. */ status?: DepartmentStatus | undefined; subsidiaries?: Array | undefined; /** * The code of the department. */ code?: string | undefined; /** * The third-party API ID of original entity */ downstreamId?: string | null | 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 AccountingDepartmentInput = { /** * A unique identifier for an object. */ parentId?: string | null | undefined; /** * Id to be displayed. */ displayId?: string | null | undefined; /** * The name of the department. */ name?: string | null | undefined; /** * Based on the status some functionality is enabled or disabled. */ status?: DepartmentStatus | undefined; subsidiaries?: Array | undefined; /** * The code of the department. */ code?: string | 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 DepartmentStatus$inboundSchema: z.ZodType< DepartmentStatus, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(DepartmentStatus) ); /** @internal */ export const DepartmentStatus$outboundSchema: z.ZodType< string, z.ZodTypeDef, DepartmentStatus > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(DepartmentStatus) ); /** @internal */ export const AccountingDepartment$inboundSchema: z.ZodType< AccountingDepartment, 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(), name: z.nullable(types.string()).optional(), status: types.optional(DepartmentStatus$inboundSchema), subsidiaries: types.optional(z.array(SubsidiaryReference$inboundSchema)), code: types.optional(types.string()), downstream_id: z.nullable(types.string()).optional(), 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", "custom_mappings": "customMappings", "row_version": "rowVersion", "updated_by": "updatedBy", "created_by": "createdBy", "updated_at": "updatedAt", "created_at": "createdAt", "pass_through": "passThrough", }); }) ); export function accountingDepartmentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingDepartment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingDepartment' from JSON`, ); } /** @internal */ export type AccountingDepartmentInput$Outbound = { parent_id?: string | null | undefined; display_id?: string | null | undefined; name?: string | null | undefined; status?: string | undefined; subsidiaries?: Array | undefined; code?: string | undefined; row_version?: string | null | undefined; pass_through?: Array | undefined; }; /** @internal */ export const AccountingDepartmentInput$outboundSchema: z.ZodType< AccountingDepartmentInput$Outbound, z.ZodTypeDef, AccountingDepartmentInput > = /* @__PURE__ */ lazySchema$(() => z.object({ parentId: z.nullable(z.string()).optional(), displayId: z.nullable(z.string()).optional(), name: z.nullable(z.string()).optional(), status: DepartmentStatus$outboundSchema.optional(), subsidiaries: z.array(SubsidiaryReferenceInput$outboundSchema).optional(), code: z.string().optional(), rowVersion: z.nullable(z.string()).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { parentId: "parent_id", displayId: "display_id", rowVersion: "row_version", passThrough: "pass_through", }); }) ); export function accountingDepartmentInputToJSON( accountingDepartmentInput: AccountingDepartmentInput, ): string { return JSON.stringify( AccountingDepartmentInput$outboundSchema.parse(accountingDepartmentInput), ); }