/* * 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"; /** * The type of payment method. */ export const AccountingPaymentMethodType = { Cash: "cash", Check: "check", CreditCard: "credit_card", DebitCard: "debit_card", BankTransfer: "bank_transfer", Electronic: "electronic", Other: "other", Unknown: "unknown", } as const; /** * The type of payment method. */ export type AccountingPaymentMethodType = OpenEnum< typeof AccountingPaymentMethodType >; /** * The status of the payment method. */ export const AccountingPaymentMethodStatus = { Active: "active", Inactive: "inactive", } as const; /** * The status of the payment method. */ export type AccountingPaymentMethodStatus = OpenEnum< typeof AccountingPaymentMethodStatus >; export type AccountingPaymentMethod = { /** * A unique identifier for an object. */ id?: string | undefined; /** * The name of the payment method. */ name?: string | undefined; /** * The type of payment method. */ type?: AccountingPaymentMethodType | null | undefined; /** * The status of the payment method. */ status?: AccountingPaymentMethodStatus | null | undefined; /** * When custom mappings are configured on the resource, the result is included here. */ customMappings?: { [k: string]: any } | null | undefined; /** * The third-party API ID of original entity */ downstreamId?: string | 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 AccountingPaymentMethodInput = { /** * The name of the payment method. */ name?: string | undefined; /** * The type of payment method. */ type?: AccountingPaymentMethodType | null | undefined; /** * The status of the payment method. */ status?: AccountingPaymentMethodStatus | 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 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 AccountingPaymentMethodType$inboundSchema: z.ZodType< AccountingPaymentMethodType, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(AccountingPaymentMethodType) ); /** @internal */ export const AccountingPaymentMethodType$outboundSchema: z.ZodType< string, z.ZodTypeDef, AccountingPaymentMethodType > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(AccountingPaymentMethodType) ); /** @internal */ export const AccountingPaymentMethodStatus$inboundSchema: z.ZodType< AccountingPaymentMethodStatus, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(AccountingPaymentMethodStatus) ); /** @internal */ export const AccountingPaymentMethodStatus$outboundSchema: z.ZodType< string, z.ZodTypeDef, AccountingPaymentMethodStatus > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(AccountingPaymentMethodStatus) ); /** @internal */ export const AccountingPaymentMethod$inboundSchema: z.ZodType< AccountingPaymentMethod, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), name: types.optional(types.string()), type: z.nullable(AccountingPaymentMethodType$inboundSchema).optional(), status: z.nullable(AccountingPaymentMethodStatus$inboundSchema).optional(), custom_mappings: z.nullable(z.record(z.any())).optional(), downstream_id: z.nullable(types.string()).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, { "custom_mappings": "customMappings", "downstream_id": "downstreamId", "row_version": "rowVersion", "updated_by": "updatedBy", "created_by": "createdBy", "updated_at": "updatedAt", "created_at": "createdAt", "pass_through": "passThrough", }); }) ); export function accountingPaymentMethodFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingPaymentMethod$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingPaymentMethod' from JSON`, ); } /** @internal */ export type AccountingPaymentMethodInput$Outbound = { name?: string | undefined; type?: string | null | undefined; status?: string | null | undefined; row_version?: string | null | undefined; pass_through?: Array | undefined; }; /** @internal */ export const AccountingPaymentMethodInput$outboundSchema: z.ZodType< AccountingPaymentMethodInput$Outbound, z.ZodTypeDef, AccountingPaymentMethodInput > = /* @__PURE__ */ lazySchema$(() => z.object({ name: z.string().optional(), type: z.nullable(AccountingPaymentMethodType$outboundSchema).optional(), status: z.nullable(AccountingPaymentMethodStatus$outboundSchema).optional(), rowVersion: z.nullable(z.string()).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { rowVersion: "row_version", passThrough: "pass_through", }); }) ); export function accountingPaymentMethodInputToJSON( accountingPaymentMethodInput: AccountingPaymentMethodInput, ): string { return JSON.stringify( AccountingPaymentMethodInput$outboundSchema.parse( accountingPaymentMethodInput, ), ); }