/* * 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 { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { AggregatedEntitlementBucket, AggregatedEntitlementBucket$inboundSchema, } from "./aggregated-entitlement-bucket.js"; import { EntitlementAggregationMode, EntitlementAggregationMode$inboundSchema, } from "./entitlement-aggregation-mode.js"; import { EntitlementUsageResetPeriod, EntitlementUsageResetPeriod$inboundSchema, } from "./entitlement-usage-reset-period.js"; import { SDKValidationError } from "./sdk-validation-error.js"; export type ConfigValue = {}; export type AggregatedEntitlement = { aggregationMode?: EntitlementAggregationMode | undefined; buckets?: Array | undefined; configValues?: Array<{ [k: string]: ConfigValue }> | undefined; isEnabled?: boolean | undefined; isSoftLimit?: boolean | undefined; staticValues?: Array | undefined; usageLimit?: number | undefined; usageResetPeriod?: EntitlementUsageResetPeriod | undefined; }; /** @internal */ export const ConfigValue$inboundSchema: z.ZodMiniType = z .object({}); export function configValueFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ConfigValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ConfigValue' from JSON`, ); } /** @internal */ export const AggregatedEntitlement$inboundSchema: z.ZodMiniType< AggregatedEntitlement, unknown > = z.pipe( z.object({ aggregation_mode: types.optional(EntitlementAggregationMode$inboundSchema), buckets: types.optional(z.array(AggregatedEntitlementBucket$inboundSchema)), config_values: types.optional( z.array(z.record(z.string(), z.lazy(() => ConfigValue$inboundSchema))), ), is_enabled: types.optional(types.boolean()), is_soft_limit: types.optional(types.boolean()), static_values: types.optional(z.array(types.string())), usage_limit: types.optional(types.number()), usage_reset_period: types.optional( EntitlementUsageResetPeriod$inboundSchema, ), }), z.transform((v) => { return remap$(v, { "aggregation_mode": "aggregationMode", "config_values": "configValues", "is_enabled": "isEnabled", "is_soft_limit": "isSoftLimit", "static_values": "staticValues", "usage_limit": "usageLimit", "usage_reset_period": "usageResetPeriod", }); }), ); export function aggregatedEntitlementFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AggregatedEntitlement$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AggregatedEntitlement' from JSON`, ); }