/* * 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 { CustomFieldCheckboxProperties, CustomFieldCheckboxProperties$Outbound, CustomFieldCheckboxProperties$outboundSchema, } from "./customfieldcheckboxproperties.js"; export type CustomFieldCreateCheckboxMetadata = | string | number | number | boolean; /** * Schema to create a custom field of type checkbox. */ export type CustomFieldCreateCheckbox = { /** * 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; type: "checkbox"; /** * Identifier of the custom field. It'll be used as key when storing the value. Must be unique across the organization.It can only contain ASCII letters, numbers and hyphens. */ slug: string; /** * Name of the custom field. */ name: string; /** * The ID of the organization owning the custom field. **Required unless you use an organization token.** */ organizationId?: string | null | undefined; properties: CustomFieldCheckboxProperties; }; /** @internal */ export type CustomFieldCreateCheckboxMetadata$Outbound = | string | number | number | boolean; /** @internal */ export const CustomFieldCreateCheckboxMetadata$outboundSchema: z.ZodMiniType< CustomFieldCreateCheckboxMetadata$Outbound, CustomFieldCreateCheckboxMetadata > = smartUnion([z.string(), z.int(), z.number(), z.boolean()]); export function customFieldCreateCheckboxMetadataToJSON( customFieldCreateCheckboxMetadata: CustomFieldCreateCheckboxMetadata, ): string { return JSON.stringify( CustomFieldCreateCheckboxMetadata$outboundSchema.parse( customFieldCreateCheckboxMetadata, ), ); } /** @internal */ export type CustomFieldCreateCheckbox$Outbound = { metadata?: { [k: string]: string | number | number | boolean } | undefined; type: "checkbox"; slug: string; name: string; organization_id?: string | null | undefined; properties: CustomFieldCheckboxProperties$Outbound; }; /** @internal */ export const CustomFieldCreateCheckbox$outboundSchema: z.ZodMiniType< CustomFieldCreateCheckbox$Outbound, CustomFieldCreateCheckbox > = z.pipe( z.object({ metadata: z.optional( z.record( z.string(), smartUnion([z.string(), z.int(), z.number(), z.boolean()]), ), ), type: z.literal("checkbox"), slug: z.string(), name: z.string(), organizationId: z.optional(z.nullable(z.string())), properties: CustomFieldCheckboxProperties$outboundSchema, }), z.transform((v) => { return remap$(v, { organizationId: "organization_id", }); }), ); export function customFieldCreateCheckboxToJSON( customFieldCreateCheckbox: CustomFieldCreateCheckbox, ): string { return JSON.stringify( CustomFieldCreateCheckbox$outboundSchema.parse(customFieldCreateCheckbox), ); }