/* * 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 { BillingPeriod, BillingPeriod$inboundSchema, } from "./billing-period.js"; import { EntitlementSourceEntityType, EntitlementSourceEntityType$inboundSchema, } from "./entitlement-source-entity-type.js"; import { SDKValidationError } from "./sdk-validation-error.js"; export type EntitlementSource = { configValue?: { [k: string]: any } | undefined; entitlementId?: string | undefined; entityId?: string | undefined; entityName?: string | undefined; entityType?: EntitlementSourceEntityType | undefined; isEnabled?: boolean | undefined; quantity?: number | undefined; staticValue?: string | undefined; subscriptionId?: string | undefined; usageLimit?: number | undefined; usageResetPeriod?: BillingPeriod | undefined; }; /** @internal */ export const EntitlementSource$inboundSchema: z.ZodMiniType< EntitlementSource, unknown > = z.pipe( z.object({ config_value: types.optional(z.record(z.string(), z.any())), entitlement_id: types.optional(types.string()), entity_id: types.optional(types.string()), entity_name: types.optional(types.string()), entity_type: types.optional(EntitlementSourceEntityType$inboundSchema), is_enabled: types.optional(types.boolean()), quantity: types.optional(types.number()), static_value: types.optional(types.string()), subscription_id: types.optional(types.string()), usage_limit: types.optional(types.number()), usage_reset_period: types.optional(BillingPeriod$inboundSchema), }), z.transform((v) => { return remap$(v, { "config_value": "configValue", "entitlement_id": "entitlementId", "entity_id": "entityId", "entity_name": "entityName", "entity_type": "entityType", "is_enabled": "isEnabled", "static_value": "staticValue", "subscription_id": "subscriptionId", "usage_limit": "usageLimit", "usage_reset_period": "usageResetPeriod", }); }), ); export function entitlementSourceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EntitlementSource$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EntitlementSource' from JSON`, ); }