/* * 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 { EntitlementSource, EntitlementSource$inboundSchema, } from "./entitlement-source.js"; import { FeatureResponse, FeatureResponse$inboundSchema, } from "./feature-response.js"; import { SDKValidationError } from "./sdk-validation-error.js"; export type FeatureUsageSummary = { currentUsage?: string | undefined; feature?: FeatureResponse | undefined; isEnabled?: boolean | undefined; isSoftLimit?: boolean | undefined; isUnlimited?: boolean | undefined; nextUsageResetAt?: Date | undefined; sources?: Array | undefined; totalLimit?: number | undefined; usagePercent?: string | undefined; }; /** @internal */ export const FeatureUsageSummary$inboundSchema: z.ZodMiniType< FeatureUsageSummary, unknown > = z.pipe( z.object({ current_usage: types.optional(types.string()), feature: types.optional(FeatureResponse$inboundSchema), is_enabled: types.optional(types.boolean()), is_soft_limit: types.optional(types.boolean()), is_unlimited: types.optional(types.boolean()), next_usage_reset_at: types.optional(types.date()), sources: types.optional(z.array(EntitlementSource$inboundSchema)), total_limit: types.optional(types.number()), usage_percent: types.optional(types.string()), }), z.transform((v) => { return remap$(v, { "current_usage": "currentUsage", "is_enabled": "isEnabled", "is_soft_limit": "isSoftLimit", "is_unlimited": "isUnlimited", "next_usage_reset_at": "nextUsageResetAt", "total_limit": "totalLimit", "usage_percent": "usagePercent", }); }), ); export function featureUsageSummaryFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FeatureUsageSummary$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FeatureUsageSummary' from JSON`, ); }