/* * 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"; /** * Based on the status some functionality is enabled or disabled. */ export const TrackingCategoryStatus = { Active: "active", Inactive: "inactive", } as const; /** * Based on the status some functionality is enabled or disabled. */ export type TrackingCategoryStatus = OpenEnum; export type TrackingCategorySubsidiaries = { /** * The ID of the subsidiary. */ id?: string | undefined; }; export type TrackingCategory = { /** * A unique identifier for an object. */ id?: string | undefined; /** * A unique identifier for an object. */ parentId?: string | null | undefined; /** * The name of the parent tracking category. */ parentName?: string | null | undefined; /** * The name of the tracking category. */ name?: string | undefined; /** * The code of the tracking category. */ code?: string | null | undefined; /** * Based on the status some functionality is enabled or disabled. */ status?: TrackingCategoryStatus | 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; /** * The subsidiaries the account belongs to. */ subsidiaries?: Array | undefined; }; export type TrackingCategoryInput = { /** * A unique identifier for an object. */ parentId?: string | null | undefined; /** * The name of the parent tracking category. */ parentName?: string | null | undefined; /** * The name of the tracking category. */ name?: string | undefined; /** * The code of the tracking category. */ code?: string | null | undefined; /** * Based on the status some functionality is enabled or disabled. */ status?: TrackingCategoryStatus | 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; /** * The subsidiaries the account belongs to. */ subsidiaries?: Array | undefined; }; /** @internal */ export const TrackingCategoryStatus$inboundSchema: z.ZodType< TrackingCategoryStatus, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(TrackingCategoryStatus) ); /** @internal */ export const TrackingCategoryStatus$outboundSchema: z.ZodType< string, z.ZodTypeDef, TrackingCategoryStatus > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(TrackingCategoryStatus) ); /** @internal */ export const TrackingCategorySubsidiaries$inboundSchema: z.ZodType< TrackingCategorySubsidiaries, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), }) ); /** @internal */ export type TrackingCategorySubsidiaries$Outbound = { id?: string | undefined; }; /** @internal */ export const TrackingCategorySubsidiaries$outboundSchema: z.ZodType< TrackingCategorySubsidiaries$Outbound, z.ZodTypeDef, TrackingCategorySubsidiaries > = /* @__PURE__ */ lazySchema$(() => z.object({ id: z.string().optional(), }) ); export function trackingCategorySubsidiariesToJSON( trackingCategorySubsidiaries: TrackingCategorySubsidiaries, ): string { return JSON.stringify( TrackingCategorySubsidiaries$outboundSchema.parse( trackingCategorySubsidiaries, ), ); } export function trackingCategorySubsidiariesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TrackingCategorySubsidiaries$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TrackingCategorySubsidiaries' from JSON`, ); } /** @internal */ export const TrackingCategory$inboundSchema: z.ZodType< TrackingCategory, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), parent_id: z.nullable(types.string()).optional(), parent_name: z.nullable(types.string()).optional(), name: types.optional(types.string()), code: z.nullable(types.string()).optional(), status: types.optional(TrackingCategoryStatus$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)), subsidiaries: types.optional( z.array(z.lazy(() => TrackingCategorySubsidiaries$inboundSchema)), ), }).transform((v) => { return remap$(v, { "parent_id": "parentId", "parent_name": "parentName", "custom_mappings": "customMappings", "row_version": "rowVersion", "updated_by": "updatedBy", "created_by": "createdBy", "updated_at": "updatedAt", "created_at": "createdAt", "pass_through": "passThrough", }); }) ); export function trackingCategoryFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TrackingCategory$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TrackingCategory' from JSON`, ); } /** @internal */ export type TrackingCategoryInput$Outbound = { parent_id?: string | null | undefined; parent_name?: string | null | undefined; name?: string | undefined; code?: string | null | undefined; status?: string | undefined; row_version?: string | null | undefined; pass_through?: Array | undefined; subsidiaries?: Array | undefined; }; /** @internal */ export const TrackingCategoryInput$outboundSchema: z.ZodType< TrackingCategoryInput$Outbound, z.ZodTypeDef, TrackingCategoryInput > = /* @__PURE__ */ lazySchema$(() => z.object({ parentId: z.nullable(z.string()).optional(), parentName: z.nullable(z.string()).optional(), name: z.string().optional(), code: z.nullable(z.string()).optional(), status: TrackingCategoryStatus$outboundSchema.optional(), rowVersion: z.nullable(z.string()).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), subsidiaries: z.array( z.lazy(() => TrackingCategorySubsidiaries$outboundSchema), ).optional(), }).transform((v) => { return remap$(v, { parentId: "parent_id", parentName: "parent_name", rowVersion: "row_version", passThrough: "pass_through", }); }) ); export function trackingCategoryInputToJSON( trackingCategoryInput: TrackingCategoryInput, ): string { return JSON.stringify( TrackingCategoryInput$outboundSchema.parse(trackingCategoryInput), ); }