/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CreateProductOption, CreateProductOption$inboundSchema, CreateProductOption$Outbound, CreateProductOption$outboundSchema, } from "./createproductoption.js"; export type CreateProductOptionGroup = { name: string; /** * A detailed description of the option group. * * @remarks * * - Must be valid UTF-8 text * - Supports Markdown for formatting * - HTML is not permitted and will be rejected */ description?: string | undefined; /** * The minimum number of options that must be selected from this group. * * @remarks * * A value of 0 indicates that no selection from this group is required. */ minSelect: number; /** * The maximum number of options that can be selected from this group. */ maxSelect: number; /** * The options available within this group. */ options: Array; }; /** @internal */ export const CreateProductOptionGroup$inboundSchema: z.ZodType< CreateProductOptionGroup, z.ZodTypeDef, unknown > = z.object({ name: z.string(), description: z.string().optional(), minSelect: z.number().int(), maxSelect: z.number().int(), options: z.array(CreateProductOption$inboundSchema), }); /** @internal */ export type CreateProductOptionGroup$Outbound = { name: string; description?: string | undefined; minSelect: number; maxSelect: number; options: Array; }; /** @internal */ export const CreateProductOptionGroup$outboundSchema: z.ZodType< CreateProductOptionGroup$Outbound, z.ZodTypeDef, CreateProductOptionGroup > = z.object({ name: z.string(), description: z.string().optional(), minSelect: z.number().int(), maxSelect: z.number().int(), options: z.array(CreateProductOption$outboundSchema), }); export function createProductOptionGroupToJSON( createProductOptionGroup: CreateProductOptionGroup, ): string { return JSON.stringify( CreateProductOptionGroup$outboundSchema.parse(createProductOptionGroup), ); } export function createProductOptionGroupFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateProductOptionGroup$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateProductOptionGroup' from JSON`, ); }