/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { FeatureDrilldown, FeatureDrilldown$inboundSchema, FeatureDrilldown$Outbound, FeatureDrilldown$outboundSchema, } from "./featuredrilldown.js"; export type FeatureCategory = { category: string; contribution: number; drilldown: Array | null; }; /** @internal */ export const FeatureCategory$inboundSchema: z.ZodType< FeatureCategory, z.ZodTypeDef, unknown > = z.object({ category: z.string(), contribution: z.number(), drilldown: z.nullable(z.array(FeatureDrilldown$inboundSchema)), }); /** @internal */ export type FeatureCategory$Outbound = { category: string; contribution: number; drilldown: Array | null; }; /** @internal */ export const FeatureCategory$outboundSchema: z.ZodType< FeatureCategory$Outbound, z.ZodTypeDef, FeatureCategory > = z.object({ category: z.string(), contribution: z.number(), drilldown: z.nullable(z.array(FeatureDrilldown$outboundSchema)), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace FeatureCategory$ { /** @deprecated use `FeatureCategory$inboundSchema` instead. */ export const inboundSchema = FeatureCategory$inboundSchema; /** @deprecated use `FeatureCategory$outboundSchema` instead. */ export const outboundSchema = FeatureCategory$outboundSchema; /** @deprecated use `FeatureCategory$Outbound` instead. */ export type Outbound = FeatureCategory$Outbound; } export function featureCategoryToJSON( featureCategory: FeatureCategory, ): string { return JSON.stringify(FeatureCategory$outboundSchema.parse(featureCategory)); } export function featureCategoryFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FeatureCategory$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FeatureCategory' from JSON`, ); }