/* * 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 { CouponType, CouponType$inboundSchema } from "./coupon-type.js"; import { SDKValidationError } from "./sdk-validation-error.js"; import { Status, Status$inboundSchema } from "./status.js"; export type CouponApplicationResponse = { appliedAt?: Date | undefined; couponAssociationId?: string | undefined; couponId?: string | undefined; couponSnapshot?: { [k: string]: any } | undefined; createdAt?: Date | undefined; createdBy?: string | undefined; currency?: string | undefined; discountPercentage?: string | undefined; discountType?: CouponType | undefined; discountedAmount?: string | undefined; environmentId?: string | undefined; finalPrice?: string | undefined; id?: string | undefined; invoiceId?: string | undefined; invoiceLineItemId?: string | undefined; metadata?: { [k: string]: string } | undefined; originalPrice?: string | undefined; status?: Status | undefined; subscriptionId?: string | undefined; tenantId?: string | undefined; updatedAt?: Date | undefined; updatedBy?: string | undefined; }; /** @internal */ export const CouponApplicationResponse$inboundSchema: z.ZodMiniType< CouponApplicationResponse, unknown > = z.pipe( z.object({ applied_at: types.optional(types.date()), coupon_association_id: types.optional(types.string()), coupon_id: types.optional(types.string()), coupon_snapshot: types.optional(z.record(z.string(), z.any())), created_at: types.optional(types.date()), created_by: types.optional(types.string()), currency: types.optional(types.string()), discount_percentage: types.optional(types.string()), discount_type: types.optional(CouponType$inboundSchema), discounted_amount: types.optional(types.string()), environment_id: types.optional(types.string()), final_price: types.optional(types.string()), id: types.optional(types.string()), invoice_id: types.optional(types.string()), invoice_line_item_id: types.optional(types.string()), metadata: types.optional(z.record(z.string(), types.string())), original_price: types.optional(types.string()), status: types.optional(Status$inboundSchema), subscription_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, { "applied_at": "appliedAt", "coupon_association_id": "couponAssociationId", "coupon_id": "couponId", "coupon_snapshot": "couponSnapshot", "created_at": "createdAt", "created_by": "createdBy", "discount_percentage": "discountPercentage", "discount_type": "discountType", "discounted_amount": "discountedAmount", "environment_id": "environmentId", "final_price": "finalPrice", "invoice_id": "invoiceId", "invoice_line_item_id": "invoiceLineItemId", "original_price": "originalPrice", "subscription_id": "subscriptionId", "tenant_id": "tenantId", "updated_at": "updatedAt", "updated_by": "updatedBy", }); }), ); export function couponApplicationResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CouponApplicationResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CouponApplicationResponse' from JSON`, ); }