/*
* 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$ } from "../../lib/schemas.js";
import * as openEnums from "../../types/enums.js";
import { OpenEnum } from "../../types/enums.js";
import {
Address,
Address$Outbound,
Address$outboundSchema,
} from "./address.js";
import {
BankAccount,
BankAccount$Outbound,
BankAccount$outboundSchema,
} from "./bankaccount.js";
import { Currency, Currency$outboundSchema } from "./currency.js";
import {
CustomField,
CustomField$Outbound,
CustomField$outboundSchema,
} from "./customfield.js";
import { Email, Email$Outbound, Email$outboundSchema } from "./email.js";
import {
LinkedLedgerAccount,
LinkedLedgerAccount$Outbound,
LinkedLedgerAccount$outboundSchema,
} from "./linkedledgeraccount.js";
import {
LinkedParentCustomer,
LinkedParentCustomer$Outbound,
LinkedParentCustomer$outboundSchema,
} from "./linkedparentcustomer.js";
import {
LinkedSubsidiaryInput,
LinkedSubsidiaryInput$Outbound,
LinkedSubsidiaryInput$outboundSchema,
} from "./linkedsubsidiaryinput.js";
import {
LinkedTaxRateInput,
LinkedTaxRateInput$Outbound,
LinkedTaxRateInput$outboundSchema,
} from "./linkedtaxrateinput.js";
import {
PassThroughBody,
PassThroughBody$Outbound,
PassThroughBody$outboundSchema,
} from "./passthroughbody.js";
import {
PhoneNumber,
PhoneNumber$Outbound,
PhoneNumber$outboundSchema,
} from "./phonenumber.js";
import {
Website,
Website$Outbound,
Website$outboundSchema,
} from "./website.js";
/**
* Customer status
*/
export const CustomerCreateInputStatus = {
Active: "active",
Inactive: "inactive",
Archived: "archived",
GdprErasureRequest: "gdpr-erasure-request",
Unknown: "unknown",
} as const;
/**
* Customer status
*/
export type CustomerCreateInputStatus = OpenEnum<
typeof CustomerCreateInputStatus
>;
/**
* The writable shape of Customer for a batch create. Identical to [Customer](the model returned on reads) with the read-only properties removed — the same properties the single-record create endpoint rejects, so a batched record and a single-record create accept exactly the same body.
*/
export type CustomerCreateInput = {
/**
* Display ID
*/
displayId?: string | null | undefined;
/**
* Display name
*/
displayName?: string | null | undefined;
/**
* The name of the company.
*/
companyName?: string | null | undefined;
/**
* The company ID the transaction belongs to
*/
companyId?: string | null | undefined;
subsidiary?: LinkedSubsidiaryInput | null | undefined;
/**
* The category/type of the customer
*/
customerCategory?: string | null | undefined;
/**
* The job title of the person.
*/
title?: string | null | undefined;
/**
* The first name of the person.
*/
firstName?: string | null | undefined;
/**
* Middle name of the person.
*/
middleName?: string | null | undefined;
/**
* The last name of the person.
*/
lastName?: string | null | undefined;
suffix?: string | null | undefined;
/**
* Is this an individual or business customer
*/
individual?: boolean | null | undefined;
/**
* If true, indicates this is a Project.
*/
project?: boolean | null | undefined;
addresses?: Array
| undefined;
phoneNumbers?: Array | undefined;
emails?: Array | undefined;
websites?: Array | undefined;
bankAccounts?: Array | undefined;
/**
* Some notes about this customer
*/
notes?: string | null | undefined;
taxRate?: LinkedTaxRateInput | undefined;
taxNumber?: string | null | undefined;
/**
* Whether the entity is subject to taxation
*/
taxable?: boolean | null | 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;
account?: LinkedLedgerAccount | null | undefined;
/**
* The parent customer this entity is linked to.
*/
parent?: LinkedParentCustomer | null | undefined;
/**
* Customer status
*/
status?: CustomerCreateInputStatus | null | undefined;
/**
* Payment method used for the transaction, such as cash, credit card, bank transfer, or check
*/
paymentMethod?: string | null | undefined;
/**
* Terms of payment.
*/
terms?: string | null | undefined;
/**
* The ID of the payment terms
*/
termsId?: string | null | undefined;
/**
* The channel through which the transaction is processed.
*/
channel?: string | null | undefined;
customFields?: 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 CustomerCreateInputStatus$outboundSchema: z.ZodType<
string,
z.ZodTypeDef,
CustomerCreateInputStatus
> = /* @__PURE__ */ lazySchema$(() =>
openEnums.outboundSchema(CustomerCreateInputStatus)
);
/** @internal */
export type CustomerCreateInput$Outbound = {
display_id?: string | null | undefined;
display_name?: string | null | undefined;
company_name?: string | null | undefined;
company_id?: string | null | undefined;
subsidiary?: LinkedSubsidiaryInput$Outbound | null | undefined;
customer_category?: string | null | undefined;
title?: string | null | undefined;
first_name?: string | null | undefined;
middle_name?: string | null | undefined;
last_name?: string | null | undefined;
suffix?: string | null | undefined;
individual?: boolean | null | undefined;
project?: boolean | null | undefined;
addresses?: Array | undefined;
phone_numbers?: Array | undefined;
emails?: Array | undefined;
websites?: Array | undefined;
bank_accounts?: Array | undefined;
notes?: string | null | undefined;
tax_rate?: LinkedTaxRateInput$Outbound | undefined;
tax_number?: string | null | undefined;
taxable?: boolean | null | undefined;
currency?: string | null | undefined;
account?: LinkedLedgerAccount$Outbound | null | undefined;
parent?: LinkedParentCustomer$Outbound | null | undefined;
status?: string | null | undefined;
payment_method?: string | null | undefined;
terms?: string | null | undefined;
terms_id?: string | null | undefined;
channel?: string | null | undefined;
custom_fields?: Array | undefined;
row_version?: string | null | undefined;
pass_through?: Array | undefined;
};
/** @internal */
export const CustomerCreateInput$outboundSchema: z.ZodType<
CustomerCreateInput$Outbound,
z.ZodTypeDef,
CustomerCreateInput
> = /* @__PURE__ */ lazySchema$(() =>
z.object({
displayId: z.nullable(z.string()).optional(),
displayName: z.nullable(z.string()).optional(),
companyName: z.nullable(z.string()).optional(),
companyId: z.nullable(z.string()).optional(),
subsidiary: z.nullable(LinkedSubsidiaryInput$outboundSchema).optional(),
customerCategory: z.nullable(z.string()).optional(),
title: z.nullable(z.string()).optional(),
firstName: z.nullable(z.string()).optional(),
middleName: z.nullable(z.string()).optional(),
lastName: z.nullable(z.string()).optional(),
suffix: z.nullable(z.string()).optional(),
individual: z.nullable(z.boolean()).optional(),
project: z.nullable(z.boolean()).optional(),
addresses: z.array(Address$outboundSchema).optional(),
phoneNumbers: z.array(PhoneNumber$outboundSchema).optional(),
emails: z.array(Email$outboundSchema).optional(),
websites: z.array(Website$outboundSchema).optional(),
bankAccounts: z.array(BankAccount$outboundSchema).optional(),
notes: z.nullable(z.string()).optional(),
taxRate: LinkedTaxRateInput$outboundSchema.optional(),
taxNumber: z.nullable(z.string()).optional(),
taxable: z.nullable(z.boolean()).optional(),
currency: z.nullable(Currency$outboundSchema).optional(),
account: z.nullable(LinkedLedgerAccount$outboundSchema).optional(),
parent: z.nullable(LinkedParentCustomer$outboundSchema).optional(),
status: z.nullable(CustomerCreateInputStatus$outboundSchema).optional(),
paymentMethod: z.nullable(z.string()).optional(),
terms: z.nullable(z.string()).optional(),
termsId: z.nullable(z.string()).optional(),
channel: z.nullable(z.string()).optional(),
customFields: z.array(CustomField$outboundSchema).optional(),
rowVersion: z.nullable(z.string()).optional(),
passThrough: z.array(PassThroughBody$outboundSchema).optional(),
}).transform((v) => {
return remap$(v, {
displayId: "display_id",
displayName: "display_name",
companyName: "company_name",
companyId: "company_id",
customerCategory: "customer_category",
firstName: "first_name",
middleName: "middle_name",
lastName: "last_name",
phoneNumbers: "phone_numbers",
bankAccounts: "bank_accounts",
taxRate: "tax_rate",
taxNumber: "tax_number",
paymentMethod: "payment_method",
termsId: "terms_id",
customFields: "custom_fields",
rowVersion: "row_version",
passThrough: "pass_through",
});
})
);
export function customerCreateInputToJSON(
customerCreateInput: CustomerCreateInput,
): string {
return JSON.stringify(
CustomerCreateInput$outboundSchema.parse(customerCreateInput),
);
}