/* * 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 { CouponResponse, CouponResponse$inboundSchema, } from "./coupon-response.js"; import { SDKValidationError } from "./sdk-validation-error.js"; import { Status, Status$inboundSchema } from "./status.js"; import { SubscriptionLineItemResponse, SubscriptionLineItemResponse$inboundSchema, } from "./subscription-line-item-response.js"; export type CouponAssociationResponse = { coupon?: CouponResponse | undefined; couponId?: string | undefined; createdAt?: Date | undefined; createdBy?: string | undefined; /** * Optional */ endDate?: Date | undefined; environmentId?: string | undefined; id?: string | undefined; metadata?: { [k: string]: string } | undefined; startDate?: Date | undefined; status?: Status | undefined; /** * Mandatory */ subscriptionId?: string | undefined; subscriptionLineItem?: SubscriptionLineItemResponse | undefined; /** * Optional */ subscriptionLineItemId?: string | undefined; /** * Optional */ subscriptionPhaseId?: string | undefined; tenantId?: string | undefined; updatedAt?: Date | undefined; updatedBy?: string | undefined; }; /** @internal */ export const CouponAssociationResponse$inboundSchema: z.ZodMiniType< CouponAssociationResponse, unknown > = z.pipe( z.object({ coupon: types.optional(CouponResponse$inboundSchema), coupon_id: types.optional(types.string()), created_at: types.optional(types.date()), created_by: types.optional(types.string()), end_date: types.optional(types.date()), environment_id: types.optional(types.string()), id: types.optional(types.string()), metadata: types.optional(z.record(z.string(), types.string())), start_date: types.optional(types.date()), status: types.optional(Status$inboundSchema), subscription_id: types.optional(types.string()), subscription_line_item: types.optional( SubscriptionLineItemResponse$inboundSchema, ), subscription_line_item_id: types.optional(types.string()), subscription_phase_id: types.optional(types.string()), tenant_id: types.optional(types.string()), updated_at: types.optional(types.date()), updated_by: types.optional(types.string()), }), z.transform((v) => { return remap$(v, { "coupon_id": "couponId", "created_at": "createdAt", "created_by": "createdBy", "end_date": "endDate", "environment_id": "environmentId", "start_date": "startDate", "subscription_id": "subscriptionId", "subscription_line_item": "subscriptionLineItem", "subscription_line_item_id": "subscriptionLineItemId", "subscription_phase_id": "subscriptionPhaseId", "tenant_id": "tenantId", "updated_at": "updatedAt", "updated_by": "updatedBy", }); }), ); export function couponAssociationResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CouponAssociationResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CouponAssociationResponse' from JSON`, ); }