/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; import { smartUnion } from "../../types/smartUnion.js"; import { AddressInput, AddressInput$Outbound, AddressInput$outboundSchema, } from "./addressinput.js"; import { MemberOwnerCreate, MemberOwnerCreate$Outbound, MemberOwnerCreate$outboundSchema, } from "./memberownercreate.js"; export type CustomerTeamCreateMetadata = string | number | number | boolean; export type CustomerTeamCreate = { /** * Key-value object allowing you to store additional information. * * @remarks * * The key must be a string with a maximum length of **40 characters**. * The value must be either: * * * A string with a maximum length of **500 characters** * * An integer * * A floating-point number * * A boolean * * You can store up to **50 key-value pairs**. */ metadata?: { [k: string]: string | number | number | boolean } | undefined; /** * The ID of the customer in your system. This must be unique within the organization. Once set, it can't be updated. */ externalId?: string | null | undefined; name?: string | null | undefined; billingAddress?: AddressInput | null | undefined; taxId?: string | null | undefined; locale?: string | null | undefined; /** * The ID of the organization owning the customer. **Required unless you use an organization token.** */ organizationId?: string | null | undefined; /** * Optional owner member to create with the customer. If not provided, an owner member will be automatically created using the customer's email and name. */ owner?: MemberOwnerCreate | null | undefined; type: "team"; /** * The email address of the team customer. Optional for team customers — if omitted, an owner with an email must be provided. */ email?: string | null | undefined; }; /** @internal */ export type CustomerTeamCreateMetadata$Outbound = | string | number | number | boolean; /** @internal */ export const CustomerTeamCreateMetadata$outboundSchema: z.ZodMiniType< CustomerTeamCreateMetadata$Outbound, CustomerTeamCreateMetadata > = smartUnion([z.string(), z.int(), z.number(), z.boolean()]); export function customerTeamCreateMetadataToJSON( customerTeamCreateMetadata: CustomerTeamCreateMetadata, ): string { return JSON.stringify( CustomerTeamCreateMetadata$outboundSchema.parse(customerTeamCreateMetadata), ); } /** @internal */ export type CustomerTeamCreate$Outbound = { metadata?: { [k: string]: string | number | number | boolean } | undefined; external_id?: string | null | undefined; name?: string | null | undefined; billing_address?: AddressInput$Outbound | null | undefined; tax_id?: string | null | undefined; locale?: string | null | undefined; organization_id?: string | null | undefined; owner?: MemberOwnerCreate$Outbound | null | undefined; type: "team"; email?: string | null | undefined; }; /** @internal */ export const CustomerTeamCreate$outboundSchema: z.ZodMiniType< CustomerTeamCreate$Outbound, CustomerTeamCreate > = z.pipe( z.object({ metadata: z.optional( z.record( z.string(), smartUnion([z.string(), z.int(), z.number(), z.boolean()]), ), ), externalId: z.optional(z.nullable(z.string())), name: z.optional(z.nullable(z.string())), billingAddress: z.optional(z.nullable(AddressInput$outboundSchema)), taxId: z.optional(z.nullable(z.string())), locale: z.optional(z.nullable(z.string())), organizationId: z.optional(z.nullable(z.string())), owner: z.optional(z.nullable(MemberOwnerCreate$outboundSchema)), type: z.literal("team"), email: z.optional(z.nullable(z.string())), }), z.transform((v) => { return remap$(v, { externalId: "external_id", billingAddress: "billing_address", taxId: "tax_id", organizationId: "organization_id", }); }), ); export function customerTeamCreateToJSON( customerTeamCreate: CustomerTeamCreate, ): string { return JSON.stringify( CustomerTeamCreate$outboundSchema.parse(customerTeamCreate), ); }